Skip to content

Commit 7bb38ab

Browse files
author
Valeriy Khorunzhin
committed
refactoring
Signed-off-by: Valeriy Khorunzhin <[email protected]>
1 parent 11481f7 commit 7bb38ab

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/e2e/vmop/restore.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
. "github.com/onsi/gomega"
2828
k8serrors "k8s.io/apimachinery/pkg/api/errors"
2929
"k8s.io/apimachinery/pkg/api/resource"
30-
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
30+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/runtime"
3232
"k8s.io/apimachinery/pkg/runtime/schema"
3333
"k8s.io/apimachinery/pkg/types"
@@ -81,7 +81,7 @@ var _ = Describe("VirtualMachineOperationRestore", func() {
8181
util.StartVirtualMachine(f, t.VM)
8282
}
8383
util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.LongTimeout)
84-
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
84+
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.MiddleTimeout, t.VMBDA)
8585

8686
vmbdaPath := t.GetVMBDADevicePath()
8787
t.CreateVMBDAFilesystem(vmbdaPath)
@@ -117,7 +117,7 @@ var _ = Describe("VirtualMachineOperationRestore", func() {
117117

118118
util.UntilVirtualMachineRebooted(crclient.ObjectKeyFromObject(t.VM), runningLastTransitionTime, framework.LongTimeout)
119119
util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.ShortTimeout)
120-
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
120+
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.MiddleTimeout, t.VMBDA)
121121
t.MountVMBDA(t.GetVMBDADevicePath())
122122
})
123123
By("Check that VM is in changed state", func() {
@@ -143,7 +143,7 @@ var _ = Describe("VirtualMachineOperationRestore", func() {
143143
}
144144

145145
util.UntilVMAgentReady(crclient.ObjectKeyFromObject(t.VM), framework.LongTimeout)
146-
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.ShortTimeout, t.VMBDA)
146+
util.UntilObjectPhase(string(v1alpha2.BlockDeviceAttachmentPhaseAttached), framework.MiddleTimeout, t.VMBDA)
147147
t.MountVMBDA(t.GetVMBDADevicePath())
148148
}
149149
})
@@ -371,13 +371,11 @@ func (r *restoreModeTest) getDeviceBySerial(serial string) (string, bool, error)
371371
}
372372

373373
func (r *restoreModeTest) getVMBDADiskSerialNumber(vdName string) (string, bool) {
374-
unstructuredVMI := &unstructured.Unstructured{}
375-
unstructuredVMI.SetGroupVersionKind(schema.GroupVersionKind{
376-
Group: "internal.virtualization.deckhouse.io",
377-
Version: "v1",
378-
Kind: "InternalVirtualizationVirtualMachineInstance",
379-
})
380-
err := r.Framework.Clients.GenericClient().Get(context.Background(), crclient.ObjectKeyFromObject(r.VM), unstructuredVMI)
374+
unstructuredVMI, err := r.Framework.Clients.DynamicClient().Resource(schema.GroupVersionResource{
375+
Group: "internal.virtualization.deckhouse.io",
376+
Version: "v1",
377+
Resource: "internalvirtualizationvirtualmachineinstances",
378+
}).Namespace(r.VM.Namespace).Get(context.Background(), r.VM.Name, metav1.GetOptions{})
381379
Expect(err).NotTo(HaveOccurred())
382380

383381
var kvvmi virtv1.VirtualMachineInstance

0 commit comments

Comments
 (0)