Skip to content

Commit

Permalink
Ensure vif vm test waits for IP to wait for network drivers to load
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelnano committed Sep 29, 2023
1 parent ede24d3 commit 68049fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions xoa/resource_xenorchestra_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 68049fc

Please sign in to comment.