Skip to content

Commit d8844b8

Browse files
committed
improved testing and validation
1 parent ba0cbb3 commit d8844b8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

provider/agent_test.go

+27
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,33 @@ func TestAgent_ResourcesMonitoring(t *testing.T) {
299299
}},
300300
})
301301
})
302+
t.Run("MultipleMemory", func(t *testing.T) {
303+
resource.Test(t, resource.TestCase{
304+
ProviderFactories: coderFactory(),
305+
IsUnitTest: true,
306+
Steps: []resource.TestStep{{
307+
Config: `
308+
provider "coder" {
309+
url = "https://example.com"
310+
}
311+
resource "coder_agent" "dev" {
312+
os = "linux"
313+
arch = "amd64"
314+
resources_monitoring {
315+
memory {
316+
enabled = true
317+
threshold = 80
318+
}
319+
memory {
320+
enabled = true
321+
threshold = 90
322+
}
323+
}
324+
}`,
325+
ExpectError: regexp.MustCompile(`No more than 1 "memory" blocks are allowed`),
326+
}},
327+
})
328+
})
302329

303330
t.Run("InvalidThreshold", func(t *testing.T) {
304331
resource.Test(t, resource.TestCase{

0 commit comments

Comments
 (0)