Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/remove ide3 dependency tests #239

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions nutanix/resource_nutanix_virtual_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,31 @@ func TestAccNutanixVirtualMachine_CdromGuestCustomisationReboot(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"disk_list"},
ImportStateVerifyIgnore: []string{"disk_list", "cloud_init_cdrom_uuid"},
},
},
})
}

func TestAccNutanixVirtualMachine_CdromGuestCustomisationRebootWithManualCDROM(t *testing.T) {
r := acctest.RandInt()
resourceName := "nutanix_virtual_machine.vm7"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckNutanixVirtualMachineDestroy,
Steps: []resource.TestStep{
{
Config: testAccNutanixVMConfigCdromGuestCustomisationRebootWithManualCDROM(r),
Check: resource.ComposeTestCheckFunc(
testAccCheckNutanixVirtualMachineExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"disk_list", "cloud_init_cdrom_uuid"},
},
},
})
Expand Down Expand Up @@ -311,7 +335,7 @@ func TestAccNutanixVirtualMachine_CloudInitCustomKeyValues(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"disk_list"},
ImportStateVerifyIgnore: []string{"disk_list", "cloud_init_cdrom_uuid"},
},
},
})
Expand Down Expand Up @@ -824,6 +848,37 @@ func testAccNutanixVMConfigCdromGuestCustomisationReboot(r int) string {
`, r)
}

func testAccNutanixVMConfigCdromGuestCustomisationRebootWithManualCDROM(r int) string {
return fmt.Sprintf(`
data "nutanix_clusters" "clusters" {}

locals {
cluster1 = "${data.nutanix_clusters.clusters.entities.0.service_list.0 == "PRISM_CENTRAL"
? data.nutanix_clusters.clusters.entities.1.metadata.uuid : data.nutanix_clusters.clusters.entities.0.metadata.uuid}"
}

resource "nutanix_virtual_machine" "vm7" {
name = "test-dou-%d"
cluster_uuid = "${local.cluster1}"

num_vcpus_per_socket = 1
num_sockets = 1
memory_size_mib = 186
guest_customization_cloud_init_user_data = base64encode("#cloud-config\nfqdn: test.domain.local")

disk_list {
device_properties {
device_type = "CDROM"
disk_address = {
device_index = 0
adapter_type = "IDE"
}
}
}
}
`, r)
}

func testAccNutanixVMConfigCloudInitCustomKeyValues(r int) string {
return fmt.Sprintf(`
data "nutanix_clusters" "clusters" {}
Expand Down