Skip to content

Commit ebd1de8

Browse files
author
Roman Sysoev
committed
feat(vmrestore): fix merge conflicts and update e2e test case
Signed-off-by: Roman Sysoev <roman.sysoev@flant.com>
1 parent c0472c7 commit ebd1de8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

tests/e2e/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.0.0
1111
github.com/onsi/ginkgo/v2 v2.21.0
1212
github.com/onsi/gomega v1.35.1
13-
golang.org/x/sync v0.8.0
13+
golang.org/x/sync v0.14.0
1414
gopkg.in/yaml.v3 v3.0.1
1515
k8s.io/api v0.32.3
1616
k8s.io/apimachinery v0.32.3
@@ -65,7 +65,6 @@ require (
6565
github.com/xlab/treeprint v1.2.0 // indirect
6666
golang.org/x/net v0.30.0 // indirect
6767
golang.org/x/oauth2 v0.23.0 // indirect
68-
golang.org/x/sync v0.14.0 // indirect
6968
golang.org/x/sys v0.33.0 // indirect
7069
golang.org/x/term v0.32.0 // indirect
7170
golang.org/x/text v0.25.0 // indirect

tests/e2e/vm_restore_force_test.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ import (
3535

3636
var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), ginkgoutil.CommonE2ETestDecorators(), func() {
3737
const (
38-
viCount = 2
39-
vmCount = 1
40-
vdCount = 3
41-
vmbdaCount = 2
42-
hasNoConsumerDiskCount = 1
38+
viCount = 2
39+
vmCount = 1
40+
vdCount = 2
41+
vmbdaCount = 2
4342
)
4443

4544
var (
@@ -49,7 +48,7 @@ var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), ginkgoutil.Comm
4948
volumeSnapshotClass string
5049
namespace string
5150
testCaseLabel = map[string]string{"testcase": "vm-restore-force"}
52-
hasNoConsumerLabel = map[string]string{"hasNoConsumer": "vm-restore-force"}
51+
additionalDiskLabel = map[string]string{"additionalDisk": "vm-restore-force"}
5352
)
5453
BeforeEach(func() {
5554
ctx, cancel = context.WithCancel(context.Background())
@@ -68,7 +67,6 @@ var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), ginkgoutil.Comm
6867
var err error
6968
namespace, err = kustomize.GetNamespace(kustomization)
7069
Expect(err).NotTo(HaveOccurred(), "%w", err)
71-
conf.SetNamespace(namespace)
7270

7371
storageClass, err = GetDefaultStorageClass()
7472
Expect(err).NotTo(HaveOccurred(), "failed to get the `DefaultStorageClass`")
@@ -162,9 +160,9 @@ var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), ginkgoutil.Comm
162160
By("Attaching `VirtualDisk` after `VirtualMachine` snapshotting", func() {
163161
for i, vm := range vms.Items {
164162
vdName := fmt.Sprintf("%s-%d", "vd-attached-after-vm-snapshotting", i)
165-
newDisk := NewVirtualDisk(vdName, vm.Namespace, hasNoConsumerLabel, resource.NewQuantity(1*1024*1024, resource.BinarySI))
163+
newDisk := NewVirtualDisk(vdName, vm.Namespace, additionalDiskLabel, resource.NewQuantity(1*1024*1024, resource.BinarySI))
166164
CreateResource(ctx, newDisk)
167-
newVmbda := NewVirtualMachineBlockDeviceAttachment(vm.Name, vm.Namespace, newDisk.Name, virtv2.VMBDAObjectRefKindVirtualDisk, testCaseLabel)
165+
newVmbda := NewVirtualMachineBlockDeviceAttachment(vm.Name, vm.Namespace, newDisk.Name, virtv2.VMBDAObjectRefKindVirtualDisk, additionalDiskLabel)
168166
CreateResource(ctx, newVmbda)
169167

170168
WaitPhaseByLabel(
@@ -255,14 +253,22 @@ var _ = Describe("VirtualMachineRestoreForce", SIGRestoration(), ginkgoutil.Comm
255253
Resource: virtv2.VirtualMachineRestoreResource,
256254
Labels: testCaseLabel,
257255
},
256+
{
257+
Resource: virtv2.VirtualDiskResource,
258+
Labels: additionalDiskLabel,
259+
},
260+
{
261+
Resource: virtv2.VirtualMachineBlockDeviceAttachmentResource,
262+
Labels: additionalDiskLabel,
263+
},
258264
},
259265
}
260266

261267
if config.IsCleanUpNeeded() {
262268
resourcesToDelete.KustomizationDir = conf.TestData.VMRestoreForce
263269
}
264270

265-
DeleteTestCaseResources(resourcesToDelete)
271+
DeleteTestCaseResources(namespace, resourcesToDelete)
266272
})
267273
})
268274
})

0 commit comments

Comments
 (0)