diff options
author | Dario Maiocchi <dmaiocchi@suse.com> | 2017-11-14 20:22:55 +0100 |
---|---|---|
committer | Dario Maiocchi <dmaiocchi@suse.com> | 2017-11-16 16:33:14 +0100 |
commit | 9d3bfb5aaf0b51695a2dae54ede7845660d8eb70 (patch) | |
tree | 87b7fd4133f7997abb1c75f17030eedf83d5b8ba | |
parent | acad5df18a9ffd03d6f6bdd2b33f4eade8e9a09d (diff) | |
download | terraform-provider-libvirt-9d3bfb5aaf0b51695a2dae54ede7845660d8eb70.tar terraform-provider-libvirt-9d3bfb5aaf0b51695a2dae54ede7845660d8eb70.tar.gz |
Add AcceptTest for CloudInit
-rw-r--r-- | libvirt/cloudinit_def_test.go | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libvirt/cloudinit_def_test.go b/libvirt/cloudinit_def_test.go index ab01f4e7..18c63a07 100644 --- a/libvirt/cloudinit_def_test.go +++ b/libvirt/cloudinit_def_test.go @@ -1,11 +1,12 @@ package libvirt import ( + "fmt" + "github.com/hashicorp/terraform/helper/resource" "os" "path/filepath" "strings" "testing" - "gopkg.in/yaml.v2" ) @@ -161,6 +162,34 @@ ssh_authorized_keys: } } +func TestCreateCloudIsoViaPlugin(t *testing.T) { + var config = fmt.Sprintf(` + + resource "libvirt_cloudinit" "test" { + name = "commoninit.iso" + local_hostname = "tango" + pool = "default" + user_data = "#cloud-config\nssh_authorized_keys: []\n" + } + `) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckLibvirtIgnitionDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "libvirt_cloudinit.test", "name", "commoninit.iso"), + resource.TestCheckResourceAttr( + "libvirt_cloudinit.test", "local_hostname", "tango"), + ), + }, + }, + }) +} + func exists(path string) (bool, error) { _, err := os.Stat(path) if err == nil { |