summaryrefslogtreecommitdiff
path: root/libvirt/resource_libvirt_domain_test.go
diff options
context:
space:
mode:
authorThomas Hipp <thipp@suse.de>2017-07-30 14:52:19 +0200
committerFlavio Castelli <flavio@castelli.me>2017-07-31 16:33:57 +0200
commit3db390a4fbe0601af4f33f4c0f6a1c243f2119d5 (patch)
tree624fc86571c5809d4c610a6a93c71fb40df49835 /libvirt/resource_libvirt_domain_test.go
parent991da6f90957a3cba82d6e079423492c5841e74d (diff)
downloadterraform-provider-libvirt-3db390a4fbe0601af4f33f4c0f6a1c243f2119d5.tar
terraform-provider-libvirt-3db390a4fbe0601af4f33f4c0f6a1c243f2119d5.tar.gz
fix failing console port conversion
When specifying a console port, it won't panic because of an invalid interface conversion. Signed-off-by: Thomas Hipp <thipp@suse.de>
Diffstat (limited to 'libvirt/resource_libvirt_domain_test.go')
-rw-r--r--libvirt/resource_libvirt_domain_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/libvirt/resource_libvirt_domain_test.go b/libvirt/resource_libvirt_domain_test.go
index a3c4b895..1410b639 100644
--- a/libvirt/resource_libvirt_domain_test.go
+++ b/libvirt/resource_libvirt_domain_test.go
@@ -420,6 +420,54 @@ func TestAccLibvirtDomain_Filesystems(t *testing.T) {
})
}
+func TestAccLibvirtDomain_Consoles(t *testing.T) {
+ var domain libvirt.Domain
+
+ var config = fmt.Sprintf(`
+ resource "libvirt_domain" "acceptance-test-domain" {
+ name = "terraform-test"
+ console {
+ type = "pty"
+ target_port = "0"
+ source_path = "/dev/pts/1"
+ }
+ console {
+ type = "pty"
+ target_port = "0"
+ target_type = "virtio"
+ source_path = "/dev/pts/2"
+ }
+ }`)
+
+ 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", "console.0.type", "pty"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.0.target_port", "0"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.0.source_path", "/dev/pts/1"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.1.type", "pty"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.1.target_port", "0"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.1.target_type", "virtio"),
+ resource.TestCheckResourceAttr(
+ "libvirt_domain.acceptance-test-domain", "console.1.source_path", "/dev/pts/2"),
+ ),
+ },
+ },
+ })
+}
+
func testAccCheckLibvirtDomainDestroy(s *terraform.State) error {
virtConn := testAccProvider.Meta().(*Client).libvirt