summaryrefslogtreecommitdiff
path: root/libvirt/cloudinit_def_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt/cloudinit_def_test.go')
-rw-r--r--libvirt/cloudinit_def_test.go31
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 {