Skip to content

Commit aaf19bc

Browse files
committed
test: Update terraform tests for provider v0.6.7
1 parent 90192e5 commit aaf19bc

File tree

8 files changed

+266
-190
lines changed

8 files changed

+266
-190
lines changed

provisioner/terraform/resources.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ type agentAttributes struct {
2727
ConnectionTimeoutSeconds int32 `mapstructure:"connection_timeout"`
2828
TroubleshootingURL string `mapstructure:"troubleshooting_url"`
2929
MOTDFile string `mapstructure:"motd_file"`
30+
DelayLoginUntilReady bool `mapstructure:"delay_login_until_ready"`
31+
StartupScriptTimeout int32 `mapstructure:"startup_script_timeout"`
3032
}
3133

3234
// A mapping of attributes on the "coder_app" resource.
@@ -132,6 +134,8 @@ func ConvertResourcesAndParameters(modules []*tfjson.StateModule, rawGraph strin
132134
ConnectionTimeoutSeconds: attrs.ConnectionTimeoutSeconds,
133135
TroubleshootingUrl: attrs.TroubleshootingURL,
134136
MotdFile: attrs.MOTDFile,
137+
DelayLoginUntilReady: attrs.DelayLoginUntilReady,
138+
StartupScriptTimeout: attrs.StartupScriptTimeout,
135139
}
136140
switch attrs.Auth {
137141
case "token":

provisioner/terraform/resources_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,26 @@ func TestConvertResources(t *testing.T) {
105105
Architecture: "amd64",
106106
Auth: &proto.Agent_Token{},
107107
ConnectionTimeoutSeconds: 120,
108+
DelayLoginUntilReady: false,
109+
StartupScriptTimeout: 300,
108110
}, {
109111
Name: "dev2",
110112
OperatingSystem: "darwin",
111113
Architecture: "amd64",
112114
Auth: &proto.Agent_Token{},
113115
ConnectionTimeoutSeconds: 1,
114116
MotdFile: "/etc/motd",
117+
DelayLoginUntilReady: false,
118+
StartupScriptTimeout: 30,
115119
}, {
116120
Name: "dev3",
117121
OperatingSystem: "windows",
118122
Architecture: "arm64",
119123
Auth: &proto.Agent_Token{},
120124
ConnectionTimeoutSeconds: 120,
121125
TroubleshootingUrl: "https://coder.com/troubleshoot",
126+
DelayLoginUntilReady: true,
127+
StartupScriptTimeout: 300,
122128
}},
123129
}},
124130
},
@@ -231,7 +237,8 @@ func TestConvertResources(t *testing.T) {
231237
ConnectionTimeoutSeconds: 120,
232238
}},
233239
},
234-
}},
240+
},
241+
},
235242
"rich-parameters": {
236243
resources: []*proto.Resource{{
237244
Name: "dev",

provisioner/terraform/testdata/generate.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ for d in */; do
99

1010
# This needs care to update correctly.
1111
if [[ $name == "kubernetes-metadata" ]]; then
12+
popd
1213
continue
1314
fi
1415

provisioner/terraform/testdata/multiple-agents/multiple-agents.tf

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.6.4"
5+
version = "0.6.7"
66
}
77
}
88
}
@@ -13,16 +13,19 @@ resource "coder_agent" "dev1" {
1313
}
1414

1515
resource "coder_agent" "dev2" {
16-
os = "darwin"
17-
arch = "amd64"
18-
connection_timeout = 1
19-
motd_file = "/etc/motd"
16+
os = "darwin"
17+
arch = "amd64"
18+
connection_timeout = 1
19+
motd_file = "/etc/motd"
20+
startup_script_timeout = 30
21+
delay_login_until_ready = false
2022
}
2123

2224
resource "coder_agent" "dev3" {
23-
os = "windows"
24-
arch = "arm64"
25-
troubleshooting_url = "https://coder.com/troubleshoot"
25+
os = "windows"
26+
arch = "arm64"
27+
troubleshooting_url = "https://coder.com/troubleshoot"
28+
delay_login_until_ready = true
2629
}
2730

2831
resource "null_resource" "dev" {

provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json

Lines changed: 29 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provisioner/terraform/testdata/multiple-agents/multiple-agents.tfstate.json

Lines changed: 17 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)