aboutsummaryrefslogtreecommitdiff
path: root/libvirt
diff options
context:
space:
mode:
authorDean Smith <dean@zelotus.com>2017-08-29 14:10:27 +0100
committerDean Smith <dean@zelotus.com>2017-08-30 08:11:25 +0100
commitd9dcb5d6be091da70d33886a19a9224e3d3691fa (patch)
tree8d2dcfa4a0835b70a1dd689b8e94cdaa23322f21 /libvirt
parent0ac07fb315a7f2537e4a921fb08a2f9048f21bdc (diff)
downloadterraform-provider-libvirt-d9dcb5d6be091da70d33886a19a9224e3d3691fa.tar
terraform-provider-libvirt-d9dcb5d6be091da70d33886a19a9224e3d3691fa.tar.gz
Adding tests for machine and arch domain attributes from #166
Diffstat (limited to 'libvirt')
-rw-r--r--libvirt/resource_libvirt_domain_test.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/libvirt/resource_libvirt_domain_test.go b/libvirt/resource_libvirt_domain_test.go
index e4d2f542..eaaa2345 100644
--- a/libvirt/resource_libvirt_domain_test.go
+++ b/libvirt/resource_libvirt_domain_test.go
@@ -683,3 +683,55 @@ func TestAccLibvirtDomain_FirmwareTemplate(t *testing.T) {
},
})
}
+
+func TestAccLibvirtDomain_MachineType(t *testing.T) {
+ var domain libvirt.Domain
+
+ // Using machine type of pc as this is earliest QEMU target
+ // and so most likely to be available
+ var config = fmt.Sprintf(`
+ resource "libvirt_domain" "acceptance-test-domain" {
+ name = "terraform-test"
+ machine = "pc"
+ }`)
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ Providers: testAccProviders,
+ CheckDestroy: testAccCheckLibvirtDomainDestroy,
+ Steps: []resource.TestStep{
+ resource.TestStep{
+ Config: config,
+ Check: resource.ComposeTestCheckFunc(
+ testAccCheckLibvirtDomainExists("libvirt_domain.acceptance-test-domain", &domain),
+ resource.TestCheckResourceAttr("libvirt_domain.acceptance-test-domain", "machine", "pc"),
+ ),
+ },
+ },
+ })
+}
+
+func TestAccLibvirtDomain_ArchType(t *testing.T) {
+ var domain libvirt.Domain
+
+ // Using i686 as architecture in case anyone running tests on an i686 only host
+ var config = fmt.Sprintf(`
+ resource "libvirt_domain" "acceptance-test-domain" {
+ name = "terraform-test"
+ arch = "i686"
+ }`)
+
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ Providers: testAccProviders,
+ CheckDestroy: testAccCheckLibvirtDomainDestroy,
+ Steps: []resource.TestStep{
+ resource.TestStep{
+ Config: config,
+ Check: resource.ComposeTestCheckFunc(
+ testAccCheckLibvirtDomainExists("libvirt_domain.acceptance-test-domain", &domain),
+ resource.TestCheckResourceAttr("libvirt_domain.acceptance-test-domain", "arch", "i686"),
+ ),
+ },
+ },
+ })
+}