Skip to content

Commit

Permalink
Add glesys_server_disk acctest
Browse files Browse the repository at this point in the history
  • Loading branch information
norrland committed Oct 2, 2024
1 parent fb042cc commit b7dce59
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions glesys/resource_glesys_server_disk_test.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit b7dce59

Please sign in to comment.