From 68049fccaa7e19db8b86ef6adb691cb81bd626b8 Mon Sep 17 00:00:00 2001 From: Dom Del Nano Date: Thu, 28 Sep 2023 20:01:45 -0700 Subject: [PATCH] Ensure vif vm test waits for IP to wait for network drivers to load --- xoa/resource_xenorchestra_vm_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xoa/resource_xenorchestra_vm_test.go b/xoa/resource_xenorchestra_vm_test.go index 97569173..45a59e56 100644 --- a/xoa/resource_xenorchestra_vm_test.go +++ b/xoa/resource_xenorchestra_vm_test.go @@ -1130,7 +1130,7 @@ func TestAccXenorchestraVm_addVifAndRemoveVif(t *testing.T) { CheckDestroy: testAccCheckXenorchestraVmDestroy, Steps: []resource.TestStep{ { - Config: testAccVmConfig(vmName), + Config: testAccVmConfigWithWaitForIp(vmName, "true"), Check: resource.ComposeAggregateTestCheckFunc( testAccVmExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "id"), @@ -1694,6 +1694,10 @@ resource "xenorchestra_vm" "bar" { } func testAccVmConfig(vmName string) string { + return testAccVmConfigWithWaitForIp(vmName, "false") +} + +func testAccVmConfigWithWaitForIp(vmName, waitForIp string) string { return testAccCloudConfigConfig(fmt.Sprintf("vm-template-%s", vmName), "template") + testAccTemplateConfig() + fmt.Sprintf(` data "xenorchestra_network" "network" { name_label = "%s" @@ -1716,8 +1720,9 @@ resource "xenorchestra_vm" "bar" { name_label = "disk 1" size = 10001317888 } + wait_for_ip = %s } -`, accDefaultNetwork.NameLabel, accTestPool.Id, vmName, accDefaultSr.Id) +`, accDefaultNetwork.NameLabel, accTestPool.Id, vmName, accDefaultSr.Id, waitForIp) } // This sets destroy_cloud_config_vdi_after_boot and wait_for_ip. The former is required for