From deaa7aaa3718ca86e7be9c2ad40599ae205fd8a8 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Wed, 14 May 2025 10:46:45 +0300 Subject: [PATCH 1/3] omit Signed-off-by: Valeriy Khorunzhin --- tests/e2e/go.mod | 15 +++++++----- tests/e2e/go.sum | 16 ++++++------- tests/e2e/vd_snapshots_test.go | 44 +++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index c4a775a1a7..44644e350c 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -6,6 +6,7 @@ toolchain go1.23.7 require ( github.com/deckhouse/sds-replicated-volume/api v0.0.0-20241109122839-a1ae840eb5db + github.com/deckhouse/virtualization-controller v0.0.0-00010101000000-000000000000 github.com/deckhouse/virtualization/api v0.0.0-20240923080356-bb5809dba578 github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0 github.com/onsi/ginkgo/v2 v2.21.0 @@ -62,13 +63,12 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xlab/treeprint v1.2.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/term v0.25.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.7.0 // indirect golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.35.1 // indirect @@ -85,4 +85,7 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect ) -replace github.com/deckhouse/virtualization/api => ./../../api +replace ( + github.com/deckhouse/virtualization-controller => ./../../images/virtualization-artifact + github.com/deckhouse/virtualization/api => ./../../api +) diff --git a/tests/e2e/go.sum b/tests/e2e/go.sum index 63dffb493b..b23bfd175a 100644 --- a/tests/e2e/go.sum +++ b/tests/e2e/go.sum @@ -274,8 +274,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -300,20 +300,20 @@ golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/tests/e2e/vd_snapshots_test.go b/tests/e2e/vd_snapshots_test.go index 39f4a5ff6d..3fe0f7322f 100644 --- a/tests/e2e/vd_snapshots_test.go +++ b/tests/e2e/vd_snapshots_test.go @@ -17,6 +17,7 @@ limitations under the License. package e2e import ( + "context" "errors" "fmt" "strings" @@ -28,9 +29,11 @@ import ( . "github.com/onsi/gomega" storagev1 "k8s.io/api/storage/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" sdsrepvolv1 "github.com/deckhouse/sds-replicated-volume/api/v1alpha1" + "github.com/deckhouse/virtualization-controller/pkg/controller/conditions" virtv2 "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/api/core/v1alpha2/vmcondition" "github.com/deckhouse/virtualization/tests/e2e/config" @@ -384,8 +387,47 @@ var _ = Describe("Virtual disk snapshots", ginkgoutil.CommonE2ETestDecorators(), Context(fmt.Sprintf("When virtual machines in %s phase", PhaseRunning), func() { It("creates snapshots with `requiredConsistency` of attached VDs", func() { + vms, err := virtClient.VirtualMachines(conf.Namespace).List(context.Background(), v1.ListOptions{}) + Expect(err).NotTo(HaveOccurred()) + vmsFrozenDict := make(map[string]bool) + + for _, vm := range vms.Items { + frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) + vmsFrozenDict[vm.Name] = frozenCondition.Status == v1.ConditionTrue + } + + watcher, err := virtClient.VirtualMachines(conf.Namespace).Watch(context.Background(), v1.ListOptions{TimeoutSeconds: ptr.To(int64(filesystemReadyTimeout.Seconds()))}) + Expect(err).NotTo(HaveOccurred()) + var hasFrozen bool + for { + hasFrozen = false + for _, frozen := range vmsFrozenDict { + hasFrozen = hasFrozen || frozen + } + + if !hasFrozen { + watcher.Stop() + break + } + + event, ok := <-watcher.ResultChan() + if !ok { + break + } + + vm, ok := event.Object.(*virtv2.VirtualMachine) + if !ok { + continue + } + + frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) + vmsFrozenDict[vm.Name] = frozenCondition.Status == v1.ConditionTrue + } + // TODO: It is a known issue that VM filesystems after snapshot not unfreezing. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once this issue is fixed. + // Expect(hasFrozen).To(BeFalse()) + vmObjects := virtv2.VirtualMachineList{} - err := GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: conf.Namespace}) + err = GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: conf.Namespace}) Expect(err).NotTo(HaveOccurred(), "cannot get virtual machines\nstderr: %s", err) for _, vm := range vmObjects.Items { From 48bdf4886c9a1d6ddd07a2a06dd885f510ab2cce Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 22 May 2025 15:03:00 +0300 Subject: [PATCH 2/3] refactoring Signed-off-by: Valeriy Khorunzhin --- tests/e2e/go.mod | 8 +-- tests/e2e/go.sum | 16 ++--- tests/e2e/vd_snapshots_test.go | 112 +++++++++++++++------------------ 3 files changed, 64 insertions(+), 72 deletions(-) diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index 44644e350c..8f4ad5ee79 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -65,10 +65,10 @@ require ( github.com/xlab/treeprint v1.2.0 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/term v0.32.0 // indirect + golang.org/x/text v0.25.0 // indirect golang.org/x/time v0.7.0 // indirect golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.35.1 // indirect diff --git a/tests/e2e/go.sum b/tests/e2e/go.sum index b23bfd175a..c7add84cbc 100644 --- a/tests/e2e/go.sum +++ b/tests/e2e/go.sum @@ -274,8 +274,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -300,20 +300,20 @@ golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/tests/e2e/vd_snapshots_test.go b/tests/e2e/vd_snapshots_test.go index 3fe0f7322f..da56454658 100644 --- a/tests/e2e/vd_snapshots_test.go +++ b/tests/e2e/vd_snapshots_test.go @@ -225,6 +225,53 @@ func CheckFileSystemFrozen(vmName string) (bool, error) { return false, nil } +func WaitForVMsUnfrozen(timeoutSeconds int64) (bool, error) { + vms, err := virtClient.VirtualMachines(conf.Namespace).List(context.Background(), v1.ListOptions{}) + if err != nil { + return false, err + } + + vmFSFrozenByName := make(map[string]bool) + + for _, vm := range vms.Items { + frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) + vmFSFrozenByName[vm.Name] = frozenCondition.Status == v1.ConditionTrue + } + + watcher, err := virtClient.VirtualMachines(conf.Namespace).Watch(context.Background(), v1.ListOptions{TimeoutSeconds: ptr.To(timeoutSeconds)}) + if err != nil { + return false, err + } + + var hasFrozen bool + for { + hasFrozen = false + for _, frozen := range vmFSFrozenByName { + hasFrozen = hasFrozen || frozen + } + + if !hasFrozen { + watcher.Stop() + return true, nil + } + + event, ok := <-watcher.ResultChan() + if !ok { + break + } + + vm, ok := event.Object.(*virtv2.VirtualMachine) + if !ok { + continue + } + + frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) + vmFSFrozenByName[vm.Name] = frozenCondition.Status == v1.ConditionTrue + } + + return false, nil +} + var _ = Describe("Virtual disk snapshots", ginkgoutil.CommonE2ETestDecorators(), func() { BeforeEach(func() { if config.IsReusable() { @@ -387,47 +434,8 @@ var _ = Describe("Virtual disk snapshots", ginkgoutil.CommonE2ETestDecorators(), Context(fmt.Sprintf("When virtual machines in %s phase", PhaseRunning), func() { It("creates snapshots with `requiredConsistency` of attached VDs", func() { - vms, err := virtClient.VirtualMachines(conf.Namespace).List(context.Background(), v1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - vmsFrozenDict := make(map[string]bool) - - for _, vm := range vms.Items { - frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) - vmsFrozenDict[vm.Name] = frozenCondition.Status == v1.ConditionTrue - } - - watcher, err := virtClient.VirtualMachines(conf.Namespace).Watch(context.Background(), v1.ListOptions{TimeoutSeconds: ptr.To(int64(filesystemReadyTimeout.Seconds()))}) - Expect(err).NotTo(HaveOccurred()) - var hasFrozen bool - for { - hasFrozen = false - for _, frozen := range vmsFrozenDict { - hasFrozen = hasFrozen || frozen - } - - if !hasFrozen { - watcher.Stop() - break - } - - event, ok := <-watcher.ResultChan() - if !ok { - break - } - - vm, ok := event.Object.(*virtv2.VirtualMachine) - if !ok { - continue - } - - frozenCondition, _ := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) - vmsFrozenDict[vm.Name] = frozenCondition.Status == v1.ConditionTrue - } - // TODO: It is a known issue that VM filesystems after snapshot not unfreezing. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once this issue is fixed. - // Expect(hasFrozen).To(BeFalse()) - vmObjects := virtv2.VirtualMachineList{} - err = GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: conf.Namespace}) + err := GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: conf.Namespace}) Expect(err).NotTo(HaveOccurred(), "cannot get virtual machines\nstderr: %s", err) for _, vm := range vmObjects.Items { @@ -558,26 +566,10 @@ var _ = Describe("Virtual disk snapshots", ginkgoutil.CommonE2ETestDecorators(), It("checks `FileSystemFrozen` status of VMs", func() { By("Status should not be `Frozen`") - vmObjects := virtv2.VirtualMachineList{} - err := GetObjects(kc.ResourceVM, &vmObjects, kc.GetOptions{Namespace: conf.Namespace}) - Expect(err).NotTo(HaveOccurred(), "cannot get virtual machines\nstderr: %s", err) - - for _, vm := range vmObjects.Items { - Eventually(func() error { - frozen, err := CheckFileSystemFrozen(vm.Name) - if err != nil { - return nil - } - if frozen { - return errors.New("Filesystem of the Virtual Machine is frozen") - } - return nil - }).WithTimeout( - filesystemReadyTimeout, - ).WithPolling( - filesystemReadyPollingInterval, - ).Should(Succeed()) - } + _, err := WaitForVMsUnfrozen(int64(filesystemReadyTimeout.Seconds())) + Expect(err).NotTo(HaveOccurred()) + // TODO: It is a known issue that VM filesystems after snapshot not unfreezing. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once this issue is fixed. + // Expect(vmsFSUnfrozen).To(BeFalse()) }) }) From 956a495a3369f1a98e7b9055ff43bb5b7d619672 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Fri, 23 May 2025 12:08:06 +0300 Subject: [PATCH 3/3] wait snapshot phase Signed-off-by: Valeriy Khorunzhin --- tests/e2e/vd_snapshots_test.go | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/e2e/vd_snapshots_test.go b/tests/e2e/vd_snapshots_test.go index da56454658..72d7a15f40 100644 --- a/tests/e2e/vd_snapshots_test.go +++ b/tests/e2e/vd_snapshots_test.go @@ -540,29 +540,29 @@ var _ = Describe("Virtual disk snapshots", ginkgoutil.CommonE2ETestDecorators(), } }) - // TODO: It is a known issue that disk snapshots are not always created consistently. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once the consistency issue is fixed. - // It("checks snapshots of attached VDs", func() { - // By(fmt.Sprintf("Snapshots should be in %s phase", PhaseReady)) - // WaitPhaseByLabel(kc.ResourceVDSnapshot, PhaseReady, kc.WaitOptions{ - // Labels: attachedVirtualDiskLabel, - // Namespace: conf.Namespace, - // Timeout: MaxWaitTimeout, - // }) - // By("Snapshots should be consistent", func() { - // vdSnapshots := virtv2.VirtualDiskSnapshotList{} - // err := GetObjects(kc.ResourceVDSnapshot, &vdSnapshots, kc.GetOptions{ - // ExcludedLabels: []string{"hasNoConsumer"}, - // Namespace: conf.Namespace, - // Labels: attachedVirtualDiskLabel, - // }) - // Expect(err).NotTo(HaveOccurred(), "cannot get `vdSnapshots`\nstderr: %s", err) - // - // for _, snapshot := range vdSnapshots.Items { - // Expect(snapshot.Status.Consistent).ToNot(BeNil()) - // Expect(*snapshot.Status.Consistent).To(BeTrue(), "consistent field should be `true`: %s", snapshot.Name) - // } - // }) - // }) + It("checks snapshots of attached VDs", func() { + By(fmt.Sprintf("Snapshots should be in %s phase", PhaseReady)) + WaitPhaseByLabel(kc.ResourceVDSnapshot, PhaseReady, kc.WaitOptions{ + Labels: attachedVirtualDiskLabel, + Namespace: conf.Namespace, + Timeout: MaxWaitTimeout, + }) + // TODO: It is a known issue that disk snapshots are not always created consistently. To prevent this error from causing noise during testing, we disabled this check. It will need to be re-enabled once the consistency issue is fixed. + // By("Snapshots should be consistent", func() { + // vdSnapshots := virtv2.VirtualDiskSnapshotList{} + // err := GetObjects(kc.ResourceVDSnapshot, &vdSnapshots, kc.GetOptions{ + // ExcludedLabels: []string{"hasNoConsumer"}, + // Namespace: conf.Namespace, + // Labels: attachedVirtualDiskLabel, + // }) + // Expect(err).NotTo(HaveOccurred(), "cannot get `vdSnapshots`\nstderr: %s", err) + // + // for _, snapshot := range vdSnapshots.Items { + // Expect(snapshot.Status.Consistent).ToNot(BeNil()) + // Expect(*snapshot.Status.Consistent).To(BeTrue(), "consistent field should be `true`: %s", snapshot.Name) + // } + // }) + }) It("checks `FileSystemFrozen` status of VMs", func() { By("Status should not be `Frozen`")