Skip to content

Commit 0aa8b32

Browse files
committed
test(instance): add test for server with scratch storage
1 parent 677c316 commit 0aa8b32

File tree

2 files changed

+1470
-0
lines changed

2 files changed

+1470
-0
lines changed

internal/services/instance/server_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,6 +2403,48 @@ func TestAccServer_AttachDetachFileSystem(t *testing.T) {
24032403
})
24042404
}
24052405

2406+
func TestAccServer_ScratchStorage(t *testing.T) {
2407+
tt := acctest.NewTestTools(t)
2408+
defer tt.Cleanup()
2409+
2410+
resource.ParallelTest(t, resource.TestCase{
2411+
ProtoV6ProviderFactories: tt.ProviderFactories,
2412+
CheckDestroy: resource.ComposeTestCheckFunc(
2413+
instancechecks.IsServerDestroyed(tt),
2414+
instancechecks.IsVolumeDestroyed(tt),
2415+
),
2416+
Steps: []resource.TestStep{
2417+
{
2418+
Config: `
2419+
resource "scaleway_instance_volume" "main" {
2420+
size_in_gb = 20
2421+
type = "scratch"
2422+
zone = "fr-par-2"
2423+
}
2424+
2425+
resource "scaleway_instance_server" "main" {
2426+
name = "test-acc-server-scratch"
2427+
type = "H100-1-80G"
2428+
image = "ubuntu_jammy_gpu_os_12"
2429+
state = "stopped"
2430+
zone = "fr-par-2"
2431+
tags = [ "terraform-test", "scaleway_instance_server", "scratch" ]
2432+
2433+
additional_volume_ids = [scaleway_instance_volume.main.id]
2434+
}`,
2435+
Check: resource.ComposeTestCheckFunc(
2436+
isServerPresent(tt, "scaleway_instance_server.main"),
2437+
instancechecks.IsVolumePresent(tt, "scaleway_instance_volume.main"),
2438+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "type", "H100-1-80G"),
2439+
resource.TestCheckResourceAttr("scaleway_instance_server.main", "image", "ubuntu_jammy_gpu_os_12"),
2440+
resource.TestCheckResourceAttrPair("scaleway_instance_server.main", "additional_volume_ids.0", "scaleway_instance_volume.main", "id"),
2441+
resource.TestCheckResourceAttr("scaleway_instance_volume.main", "size_in_gb", "20"),
2442+
),
2443+
},
2444+
},
2445+
})
2446+
}
2447+
24062448
func TestAccServer_AdminPasswordEncryptionSSHKeyID(t *testing.T) {
24072449
tt := acctest.NewTestTools(t)
24082450
defer tt.Cleanup()

0 commit comments

Comments
 (0)