File tree Expand file tree Collapse file tree 4 files changed +69
-3
lines changed
registry/coder/modules/zed Expand file tree Collapse file tree 4 files changed +69
-3
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ sudo apt install golang-go
18
18
19
19
Check that PRs have:
20
20
21
- - [ ] All required files (` main.tf ` , ` main.test.ts ` , ` README.md ` )
21
+ - [ ] All required files (` main.tf ` , ` README.md ` , at least one ` .tftest.hcl ` )
22
22
- [ ] Proper frontmatter in README
23
- - [ ] Working tests (` bun test` )
23
+ - [ ] Working tests (` terraform test` )
24
24
- [ ] Formatted code (` bun run fmt ` )
25
25
- [ ] Avatar image for new namespaces (` avatar.png ` or ` avatar.svg ` in ` .images/ ` )
26
26
Original file line number Diff line number Diff line change 4
4
"fmt" : " bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt -recursive -diff" ,
5
5
"fmt:ci" : " bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check -recursive -diff" ,
6
6
"terraform-validate" : " ./scripts/terraform_validate.sh" ,
7
- "test" : " bun test " ,
7
+ "test" : " ./scripts/terraform_test_all.sh " ,
8
8
"update-version" : " ./update-version.sh"
9
9
},
10
10
"devDependencies" : {
Original file line number Diff line number Diff line change
1
+ run "default_output" {
2
+ command = apply
3
+
4
+ variables {
5
+ agent_id = " foo"
6
+ }
7
+
8
+ assert {
9
+ condition = output. zed_url == " zed://ssh/default.coder"
10
+ error_message = " zed_url did not match expected default URL"
11
+ }
12
+ }
13
+
14
+ run "adds_folder" {
15
+ command = apply
16
+
17
+ variables {
18
+ agent_id = " foo"
19
+ folder = " /foo/bar"
20
+ }
21
+
22
+ assert {
23
+ condition = output. zed_url == " zed://ssh/default.coder/foo/bar"
24
+ error_message = " zed_url did not include provided folder path"
25
+ }
26
+ }
27
+
28
+ run "adds_agent_name" {
29
+ command = apply
30
+
31
+ variables {
32
+ agent_id = " foo"
33
+ agent_name = " myagent"
34
+ }
35
+
36
+ assert {
37
+ condition = output. zed_url == " zed://ssh/myagent.default.default.coder"
38
+ error_message = " zed_url did not include agent_name in hostname"
39
+ }
40
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Find all directories that contain any .tftest.hcl files and run terraform test in each
5
+
6
+ run_dir () {
7
+ local dir=" $1 "
8
+ echo " ==> Running terraform test in $dir "
9
+ (cd " $dir " && terraform init -upgrade -input=false -no-color > /dev/null && terraform test -no-color -verbose)
10
+ }
11
+
12
+ mapfile -t test_dirs < <( find . -type f -name " *.tftest.hcl" -print0 | xargs -0 -I{} dirname {} | sort -u)
13
+
14
+ if [[ ${# test_dirs[@]} -eq 0 ]]; then
15
+ echo " No .tftest.hcl tests found."
16
+ exit 0
17
+ fi
18
+
19
+ status=0
20
+ for d in " ${test_dirs[@]} " ; do
21
+ if ! run_dir " $d " ; then
22
+ status=1
23
+ fi
24
+ done
25
+
26
+ exit $status
You can’t perform that action at this time.
0 commit comments