diff --git a/test/e2e/vmservice/config/wcp.yaml b/test/e2e/vmservice/config/wcp.yaml index d6fb03c1d..3603c42c5 100644 --- a/test/e2e/vmservice/config/wcp.yaml +++ b/test/e2e/vmservice/config/wcp.yaml @@ -111,3 +111,9 @@ intervals: # Empirically, Sysprep GOSC on this image reliably reports an IP in # 5.5-6 minutes so this spec needs a little more room. windows-sysprep/wait-virtual-machine-vmip: ["10m", "3s"] + + # linux-guest-customization overrides apply only to specs that boot VMs + # with LinuxPrep guest customization (VMGOSCSpec's LinuxPrep and vAppConfig + # contexts). LinuxPrep customization triggers a guest network restart/reboot + # that can push the guest's IP report past the default 5m budget. + linux-guest-customization/wait-virtual-machine-vmip: ["8m", "3s"] diff --git a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go index 78c13e830..4fd834c68 100644 --- a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go +++ b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go @@ -845,7 +845,34 @@ func VMGOSCSpec(ctx context.Context, inputGetter func() VMGOSCSpecInput) { }) It("should successfully apply vAppConfig properties to VM", Label("experimental"), func() { - createAndVerifyVM(ctx, v1a2vmParameters, true) + // The IP wait is rolled inline rather than createAndVerifyVM / + // vmoperator.WaitForVirtualMachineIP so this spec can use the + // longer "linux-guest-customization" interval (see wcp.yaml) + // without changing that shared helper's timeout for every + // other caller -- the LinuxPrep customization used here + // triggers a guest network restart/reboot that can push the + // guest's IP report past the default budget, the same + // reasoning as the "windows-sysprep" override used for + // Sysprep VMs. + vmYaml = manifestbuilders.GetVirtualMachineYamlA2(v1a2vmParameters) + Expect(clusterProxy.CreateWithArgs(ctx, vmYaml)).To(Succeed(), "failed to create virtualmachine", string(vmYaml)) + + By(fmt.Sprintf("Verify that a single VirtualMachine '%s/%s' is created", input.WCPNamespaceName, vmName)) + vmoperator.WaitForVirtualMachineToExist(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) + vmoperator.WaitForVirtualMachineConditionCreated(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) + vmoperator.WaitForVirtualMachinePowerState(ctx, config, svClusterClient, input.WCPNamespaceName, vmName, string(vmopv1.VirtualMachinePowerStateOn)) + + By(fmt.Sprintf("Verify that an IP (ipv4) is allocated to the VirtualMachine '%s/%s'", input.WCPNamespaceName, vmName)) + Eventually(func() bool { + vm, err := utils.GetVirtualMachine(ctx, svClusterClient, input.WCPNamespaceName, vmName) + if err != nil { + return false + } + + return vm.Status.Network != nil && + vm.Status.Network.PrimaryIP4 != "" && + net.ParseIP(vm.Status.Network.PrimaryIP4).To4() != nil + }, config.GetIntervals("linux-guest-customization", "wait-virtual-machine-vmip")...).Should(BeTrue()) // Verify that the vAppConfig properties are actually applied to the VM vmmoid := vmoperator.GetVirtualMachineMOID(ctx, svClusterClient, input.WCPNamespaceName, vmName)