Skip to content

Commit b3cbc0c

Browse files
test: add integration test for 'coder_app.hidden'
1 parent 7ca5ee5 commit b3cbc0c

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

integration/coder-app-hidden/main.tf

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
terraform {
2+
required_providers {
3+
coder = {
4+
source = "coder/coder"
5+
}
6+
local = {
7+
source = "hashicorp/local"
8+
}
9+
}
10+
}
11+
12+
data "coder_workspace" "me" {}
13+
14+
resource "coder_agent" "dev" {
15+
os = "linux"
16+
arch = "amd64"
17+
dir = "/workspace"
18+
}
19+
20+
resource "coder_app" "hidden" {
21+
agent_id = coder_agent.dev.id
22+
slug = "hidden"
23+
share = "owner"
24+
hidden = true
25+
}
26+
27+
resource "coder_app" "visible" {
28+
agent_id = coder_agent.dev.id
29+
slug = "visible"
30+
share = "owner"
31+
hidden = false
32+
}
33+
34+
resource "coder_app" "defaulted" {
35+
agent_id = coder_agent.dev.id
36+
slug = "defaulted"
37+
share = "owner"
38+
}
39+
40+
locals {
41+
# NOTE: these must all be strings in the output
42+
output = {
43+
"coder_app.hidden.hidden" = tostring(coder_app.hidden.hidden)
44+
"coder_app.visible.hidden" = tostring(coder_app.visible.hidden)
45+
"coder_app.defaulted.hidden" = tostring(coder_app.defaulted.hidden)
46+
}
47+
}
48+
49+
variable "output_path" {
50+
type = string
51+
}
52+
53+
resource "local_file" "output" {
54+
filename = var.output_path
55+
content = jsonencode(local.output)
56+
}
57+
58+
output "output" {
59+
value = local.output
60+
sensitive = true
61+
}
62+

integration/integration_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ func TestIntegration(t *testing.T) {
112112
"workspace_owner.ssh_public_key": `(?s)^ssh-ed25519.+$`,
113113
},
114114
},
115+
{
116+
name: "coder-app-hidden",
117+
minVersion: "v0.0.0",
118+
expectedOutput: map[string]string{
119+
"coder_app.hidden.hidden": "true",
120+
"coder_app.visible.hidden": "false",
121+
"coder_app.defaulted.hidden": "false",
122+
},
123+
},
115124
} {
116125
tt := tt
117126
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)