Skip to content

Commit

Permalink
feat
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Antoshin <[email protected]>
  • Loading branch information
danilrwx committed Feb 4, 2025
1 parent 134a029 commit 850cee9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
13 changes: 7 additions & 6 deletions tests/e2e/importer_network_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

virtv2 "github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/tests/e2e/config"
"github.com/deckhouse/virtualization/tests/e2e/ginkgoutil"
kc "github.com/deckhouse/virtualization/tests/e2e/kubectl"
Expand Down Expand Up @@ -76,8 +77,8 @@ var _ = Describe("Importer network policy", ginkgoutil.CommonE2ETestDecorators()

Context("When virtual images are applied", func() {
It("checks VIs phases", func() {
By(fmt.Sprintf("VIs should be in %s phases", PhaseReady))
WaitPhaseByLabel(kc.ResourceVI, PhaseReady, kc.WaitOptions{
By(fmt.Sprintf("VIs should be in %s phases", string(virtv2.ImageReady)))
WaitPhaseByLabel(kc.ResourceVI, string(virtv2.ImageReady), kc.WaitOptions{
Labels: testCaseLabel,
Namespace: conf.Namespace,
Timeout: MaxWaitTimeout,
Expand All @@ -87,8 +88,8 @@ var _ = Describe("Importer network policy", ginkgoutil.CommonE2ETestDecorators()

Context("When virtual disks are applied", func() {
It("checks VDs phases", func() {
By(fmt.Sprintf("VDs should be in %s phases", PhaseReady))
WaitPhaseByLabel(kc.ResourceVD, PhaseReady, kc.WaitOptions{
By(fmt.Sprintf("VDs should be in %s phases", virtv2.DiskReady))
WaitPhaseByLabel(kc.ResourceVD, string(virtv2.DiskReady), kc.WaitOptions{
Labels: testCaseLabel,
Namespace: conf.Namespace,
Timeout: MaxWaitTimeout,
Expand All @@ -98,8 +99,8 @@ var _ = Describe("Importer network policy", ginkgoutil.CommonE2ETestDecorators()

Context("When virtual machines are applied", func() {
It("checks VMs phases", func() {
By(fmt.Sprintf("VMs should be in %s phases", PhaseRunning))
WaitPhaseByLabel(kc.ResourceVM, PhaseRunning, kc.WaitOptions{
By(fmt.Sprintf("VMs should be in %s phases", virtv2.MachineRunning))
WaitPhaseByLabel(kc.ResourceVM, string(virtv2.MachineRunning), kc.WaitOptions{
Labels: testCaseLabel,
Namespace: conf.Namespace,
Timeout: MaxWaitTimeout,
Expand Down
18 changes: 13 additions & 5 deletions tests/e2e/testdata/importer-network-policy/base/vd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ spec:
type: HTTP
http:
url: https://0e773854-6b4e-4e76-a65b-d9d81675451a.selstorage.ru/alpine/alpine-v3-20.qcow2
# dataSource:
# type: ObjectRef
# objectRef:
# kind: ClusterVirtualImage
# name: cvi
---
apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualDisk
metadata:
name: vd-cvi
spec:
persistentVolumeClaim:
size: 512Mi
dataSource:
type: ObjectRef
objectRef:
kind: ClusterVirtualImage
name: cvi
2 changes: 2 additions & 0 deletions tests/e2e/testdata/importer-network-policy/base/vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ spec:
blockDeviceRefs:
- kind: VirtualDisk
name: vd
- kind: VirtualDisk
name: vd-cvi
cpu:
cores: 1
coreFraction: 5%
Expand Down
14 changes: 2 additions & 12 deletions tests/e2e/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,18 +465,8 @@ func DeleteTestCaseResources(resources ResourcesToDelete) {

if resources.KustomizationDir != "" {
kustimizationFile := fmt.Sprintf("%s/%s", resources.KustomizationDir, "kustomization.yaml")
nsFile := fmt.Sprintf("%s/%s", resources.KustomizationDir, "ns.yaml")
projectFile := fmt.Sprintf("%s/%s", resources.KustomizationDir, "project.yaml")

if _, err := os.Stat(nsFile); !errors.Is(err, os.ErrNotExist) {
err := kustomize.ExcludeResource(kustimizationFile, "ns.yaml")
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("%s\nkustomizationDir: %s\nstderr: %s", errMessage, resources.KustomizationDir, err))
}

if _, err := os.Stat(projectFile); !errors.Is(err, os.ErrNotExist) {
err = kustomize.ExcludeResource(kustimizationFile, "project.yaml")
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("%s\nkustomizationDir: %s\nstderr: %s", errMessage, resources.KustomizationDir, err))
}
err := kustomize.ExcludeResource(kustimizationFile, "ns.yaml")
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("%s\nkustomizationDir: %s\nstderr: %s", errMessage, resources.KustomizationDir, err))

res := kubectl.Delete(kc.DeleteOptions{
Filename: []string{resources.KustomizationDir},
Expand Down

0 comments on commit 850cee9

Please sign in to comment.