Skip to content

Commit 3f60db4

Browse files
authored
Fix nil derreferencing on template errors (#134)
1 parent b41c379 commit 3f60db4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

iterative/resource_runner_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,35 @@ func TestScript(t *testing.T) {
1616
data := make(map[string]interface{})
1717
data["ami"] = isAMIAvailable("aws", "us-east-1")
1818

19-
script, _ := renderScript(data)
19+
script, err := renderScript(data)
20+
assert.Nil(t, err)
2021
assert.NotContains(t, script, "sudo ubuntu-drivers autoinstall")
2122
})
2223

2324
t.Run("AWS unknown region should add the NVIDA drivers", func(t *testing.T) {
2425
data := make(map[string]interface{})
2526
data["ami"] = isAMIAvailable("aws", "us-east-99")
2627

27-
script, _ := renderScript(data)
28+
script, err := renderScript(data)
29+
assert.Nil(t, err)
2830
assert.Contains(t, script, "sudo ubuntu-drivers autoinstall")
2931
})
3032

3133
t.Run("Azure known region should add the NVIDA drivers", func(t *testing.T) {
3234
data := make(map[string]interface{})
3335
data["ami"] = isAMIAvailable("azure", "westus")
3436

35-
script, _ := renderScript(data)
37+
script, err := renderScript(data)
38+
assert.Nil(t, err)
3639
assert.Contains(t, script, "sudo ubuntu-drivers autoinstall")
3740
})
3841

3942
t.Run("Azure unknown region should add the NVIDA drivers", func(t *testing.T) {
4043
data := make(map[string]interface{})
4144
data["ami"] = isAMIAvailable("azure", "us-east-99")
4245

43-
script, _ := renderScript(data)
46+
script, err := renderScript(data)
47+
assert.Nil(t, err)
4448
assert.Contains(t, script, "sudo ubuntu-drivers autoinstall")
4549
})
4650

@@ -49,7 +53,8 @@ func TestScript(t *testing.T) {
4953
startupScript, _ := base64.StdEncoding.DecodeString("ZWNobyAiaGVsbG8gd29ybGQiCmVjaG8gImJ5ZSB3b3JsZCI=")
5054
data["runner_startup_script"] = string(startupScript)
5155

52-
script, _ := renderScript(data)
56+
script, err := renderScript(data)
57+
assert.Nil(t, err)
5358
assert.Contains(t, script, "echo \"hello world\"\necho \"bye world\"")
5459
})
5560
}

0 commit comments

Comments
 (0)