Skip to content

Commit 7fc70af

Browse files
authored
vmservice - remove IP check if private network (#3610)
1 parent b1be551 commit 7fc70af

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

tests/e2e/vmservice_vm.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
210210

211211
var pandoraSyncWaitTime int
212212
var err error
213+
var vmIp string
213214
curtime := time.Now().Unix()
214215
curtimestring := strconv.FormatInt(curtime, 10)
215216
pvcName := "cns-pvc-" + curtimestring
@@ -303,26 +304,26 @@ var _ bool = ginkgo.Describe("[vmsvc] vm service with csi vol tests", func() {
303304
gomega.Expect(err).NotTo(gomega.HaveOccurred())
304305
}()
305306

306-
ginkgo.By("Wait for VM to come up and get an IP")
307-
vmIp, err := waitNgetVmsvcVmIp(ctx, vmopC, namespace, vm.Name)
308-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
307+
isPrivateNetwork := GetBoolEnvVarOrDefault("IS_PRIVATE_NETWORK", false)
308+
if !isPrivateNetwork {
309+
ginkgo.By("Wait for VM to come up and get an IP")
310+
vmIp, err = waitNgetVmsvcVmIp(ctx, vmopC, namespace, vm.Name)
311+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
309312

310-
ginkgo.By("Wait and verify PVCs are attached to the VM")
311-
gomega.Expect(waitNverifyPvcsAreAttachedToVmsvcVm(ctx, vmopC, cnsopC, vm,
312-
[]*v1.PersistentVolumeClaim{pvc, staticPvc})).NotTo(gomega.HaveOccurred())
313+
ginkgo.By("Wait and verify PVCs are attached to the VM")
314+
gomega.Expect(waitNverifyPvcsAreAttachedToVmsvcVm(ctx, vmopC, cnsopC, vm,
315+
[]*v1.PersistentVolumeClaim{pvc, staticPvc})).NotTo(gomega.HaveOccurred())
313316

314-
if latebinding {
315-
ginkgo.By("Validating that the PVC transitions to Bound state after the " +
316-
"volume is attached to the VM using a late-binding storage policy")
317-
pvs, err := fpv.WaitForPVClaimBoundPhase(ctx, client, []*v1.PersistentVolumeClaim{pvc, staticPvc}, pollTimeout)
318-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
319-
pv := pvs[0]
320-
volHandle = pv.Spec.CSI.VolumeHandle
321-
gomega.Expect(volHandle).NotTo(gomega.BeEmpty())
322-
}
317+
if latebinding {
318+
ginkgo.By("Validating that the PVC transitions to Bound state after the " +
319+
"volume is attached to the VM using a late-binding storage policy")
320+
pvs, err := fpv.WaitForPVClaimBoundPhase(ctx, client, []*v1.PersistentVolumeClaim{pvc, staticPvc}, pollTimeout)
321+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
322+
pv := pvs[0]
323+
volHandle = pv.Spec.CSI.VolumeHandle
324+
gomega.Expect(volHandle).NotTo(gomega.BeEmpty())
325+
}
323326

324-
isPrivateNetwork := GetBoolEnvVarOrDefault("IS_PRIVATE_NETWORK", false)
325-
if !isPrivateNetwork {
326327
ginkgo.By("Verify PVCs are accessible to the VM")
327328
ginkgo.By("Write some IO to the CSI volumes and read it back from them and verify the data integrity")
328329
vm, err = getVmsvcVM(ctx, vmopC, vm.Namespace, vm.Name) // refresh vm info

0 commit comments

Comments
 (0)