From b7dce5969a4434a6886ee940c7a097edeedc0ecb Mon Sep 17 00:00:00 2001 From: Andreas Eriksson Date: Wed, 2 Oct 2024 09:30:33 +0200 Subject: [PATCH] Add glesys_server_disk acctest --- glesys/resource_glesys_server_disk_test.go | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 glesys/resource_glesys_server_disk_test.go diff --git a/glesys/resource_glesys_server_disk_test.go b/glesys/resource_glesys_server_disk_test.go new file mode 100644 index 0000000..fd95c9d --- /dev/null +++ b/glesys/resource_glesys_server_disk_test.go @@ -0,0 +1,40 @@ +package glesys + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccServerDiskVMware_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-vmw-disk") + sName := acctest.RandomWithPrefix("tf-srv-vmw") + + name := "glesys_server_disk.test" + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testGlesysProviders, + Steps: []resource.TestStep{ + { + Config: testAccGlesysServerBase_VMware(sName) + testAccGlesysServerDisk_VMware(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "name", rName), + resource.TestCheckResourceAttr(name, "size", "20"), + resource.TestCheckResourceAttr(name, "type", "silver"), + ), + }, + }, + }) +} + +func testAccGlesysServerDisk_VMware(name string) string { + return fmt.Sprintf(` + resource "glesys_server_disk" "test" { + serverid = glesys_server.test.id + name = "%s" + size = 20 + type = "silver" + } `, name) +}