Skip to content

Commit 69abf48

Browse files
test: add terraform tests to kiro module (#529)
## Description Add terraform tests to kiro module ## Type of Change - [ ] New module - [ ] New template - [ ] Bug fix - [x] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder/modules/kiro` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun fmt`) - [x] Changes tested locally ## Related Issues #308 Signed-off-by: Anis KHALFALLAH <khalfallah.anis@hotmail.com> Co-authored-by: DevCats <christofer@coder.com>
1 parent 578ed89 commit 69abf48

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
run "required_vars" {
2+
command = plan
3+
4+
variables {
5+
agent_id = "foo"
6+
}
7+
}
8+
9+
run "default_output" {
10+
command = plan
11+
12+
variables {
13+
agent_id = "foo"
14+
}
15+
16+
assert {
17+
condition = output.kiro_url == "kiro://coder.coder-remote/open?owner=default&workspace=default&url=https://mydeployment.coder.com&token=$SESSION_TOKEN"
18+
error_message = "Default kiro_url must match expected value"
19+
}
20+
21+
assert {
22+
condition = coder_app.kiro.order == null
23+
error_message = "coder_app order must be null by default"
24+
}
25+
}
26+
27+
run "adds_folder" {
28+
command = plan
29+
30+
variables {
31+
agent_id = "foo"
32+
folder = "/foo/bar"
33+
}
34+
35+
assert {
36+
condition = output.kiro_url == "kiro://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&url=https://mydeployment.coder.com&token=$SESSION_TOKEN"
37+
error_message = "URL must include folder parameter"
38+
}
39+
}
40+
41+
run "folder_and_open_recent" {
42+
command = plan
43+
44+
variables {
45+
agent_id = "foo"
46+
folder = "/foo/bar"
47+
open_recent = true
48+
}
49+
50+
assert {
51+
condition = output.kiro_url == "kiro://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&openRecent&url=https://mydeployment.coder.com&token=$SESSION_TOKEN"
52+
error_message = "URL must include folder and openRecent parameters"
53+
}
54+
}
55+
56+
run "custom_slug_display_name" {
57+
command = plan
58+
59+
variables {
60+
agent_id = "foo"
61+
slug = "kiro-ai"
62+
display_name = "Kiro AI IDE"
63+
}
64+
65+
assert {
66+
condition = coder_app.kiro.slug == "kiro-ai"
67+
error_message = "coder_app slug must be set to kiro-ai"
68+
}
69+
70+
assert {
71+
condition = coder_app.kiro.display_name == "Kiro AI IDE"
72+
error_message = "coder_app display_name must be set to Kiro AI IDE"
73+
}
74+
}
75+
76+
run "sets_order" {
77+
command = plan
78+
79+
variables {
80+
agent_id = "foo"
81+
order = 5
82+
}
83+
84+
assert {
85+
condition = coder_app.kiro.order == 5
86+
error_message = "coder_app order must be set to 5"
87+
}
88+
}
89+
90+
run "sets_group" {
91+
command = plan
92+
93+
variables {
94+
agent_id = "foo"
95+
group = "AI IDEs"
96+
}
97+
98+
assert {
99+
condition = coder_app.kiro.group == "AI IDEs"
100+
error_message = "coder_app group must be set to AI IDEs"
101+
}
102+
}
103+
104+
run "writes_mcp_json" {
105+
command = plan
106+
107+
variables {
108+
agent_id = "foo"
109+
mcp = jsonencode({
110+
servers = {
111+
demo = { url = "http://localhost:1234" }
112+
}
113+
})
114+
}
115+
116+
assert {
117+
condition = strcontains(coder_script.kiro_mcp[0].script, base64encode(jsonencode({
118+
servers = {
119+
demo = { url = "http://localhost:1234" }
120+
}
121+
})))
122+
error_message = "coder_script must contain base64-encoded MCP JSON"
123+
}
124+
}

0 commit comments

Comments
 (0)