From f295511b90bb506b27807fae5b995e34f1aec071 Mon Sep 17 00:00:00 2001 From: MalloZup Date: Mon, 20 Aug 2018 15:29:38 +0200 Subject: [PATCH] add autostart false testcase --- libvirt/resource_libvirt_domain_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libvirt/resource_libvirt_domain_test.go b/libvirt/resource_libvirt_domain_test.go index 86c393a42..c337df690 100644 --- a/libvirt/resource_libvirt_domain_test.go +++ b/libvirt/resource_libvirt_domain_test.go @@ -508,23 +508,37 @@ func TestAccLibvirtDomain_Cpu(t *testing.T) { func TestAccLibvirtDomain_Autostart(t *testing.T) { var domain libvirt.Domain - var config = fmt.Sprintf(` + var autostartTrue = fmt.Sprintf(` resource "libvirt_domain" "acceptance-test-domain" { name = "terraform-test" autostart = true }`) + + var autostartFalse = fmt.Sprintf(` + resource "libvirt_domain" "acceptance-test-domain" { + name = "terraform-test" + autostart = false + }`) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckLibvirtDomainDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: autostartTrue, Check: resource.ComposeTestCheckFunc( testAccCheckLibvirtDomainExists("libvirt_domain.acceptance-test-domain", &domain), resource.TestCheckResourceAttr("libvirt_domain.acceptance-test-domain", "autostart", "true"), ), }, + { + Config: autostartFalse, + Check: resource.ComposeTestCheckFunc( + testAccCheckLibvirtDomainExists("libvirt_domain.acceptance-test-domain", &domain), + resource.TestCheckResourceAttr("libvirt_domain.acceptance-test-domain", "autostart", "false"), + ), + }, }, }) }