Skip to content

Commit 526908c

Browse files
committed
Add IncompatibleSwapSizeZero test case
1 parent daabfde commit 526908c

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

builder/linode/builder_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,27 @@ func TestBuilderPrepare_CustomDisksValidation(t *testing.T) {
10271027
}
10281028
})
10291029

1030+
t.Run("IncompatibleSwapSizeZero", func(t *testing.T) {
1031+
var b Builder
1032+
config := testConfig()
1033+
delete(config, "image")
1034+
config["swap_size"] = 0
1035+
config["disk"] = []map[string]any{
1036+
{"label": "boot", "size": 25000, "image": "linode/arch"},
1037+
}
1038+
config["config"] = []map[string]any{
1039+
{"label": "my-config"},
1040+
}
1041+
1042+
_, _, err := b.Prepare(config)
1043+
if err == nil {
1044+
t.Fatal("expected error with swap_size=0 and custom disks")
1045+
}
1046+
if !strings.Contains(err.Error(), "swap_size cannot be specified when using custom disks") {
1047+
t.Fatalf("expected specific error message, got: %s", err)
1048+
}
1049+
})
1050+
10301051
t.Run("IncompatibleStackScriptID", func(t *testing.T) {
10311052
var b Builder
10321053
config := testConfig()

0 commit comments

Comments
 (0)