@@ -73,18 +73,27 @@ func TestIntegration(t *testing.T) {
7373 name : "test-data-source" ,
7474 minVersion : "v0.0.0" ,
7575 expectedOutput : map [string ]string {
76- "provisioner.arch" : runtime .GOARCH ,
77- "provisioner.id" : `[a-zA-Z0-9-]+` ,
78- "provisioner.os" : runtime .GOOS ,
79- "workspace.access_port" : `\d+` ,
80- "workspace.access_url" : `https?://\D+:\d+` ,
81- "workspace.id" : `[a-zA-z0-9-]+` ,
82- "workspace.name" : `test-data-source` ,
83- "workspace.start_count" : `1` ,
84- "workspace.template_id" : `[a-zA-Z0-9-]+` ,
85- "workspace.template_name" : `test-data-source` ,
86- "workspace.template_version" : `.+` ,
87- "workspace.transition" : `start` ,
76+ "provisioner.arch" : runtime .GOARCH ,
77+ "provisioner.id" : `[a-zA-Z0-9-]+` ,
78+ "provisioner.os" : runtime .GOOS ,
79+ "workspace.access_port" : `\d+` ,
80+ "workspace.access_url" : `https?://\D+:\d+` ,
81+ "workspace.id" : `[a-zA-z0-9-]+` ,
82+ "workspace.name" : `test-data-source` ,
83+ "workspace.start_count" : `1` ,
84+ "workspace.template_id" : `[a-zA-Z0-9-]+` ,
85+ "workspace.template_name" : `test-data-source` ,
86+ "workspace.template_version" : `.+` ,
87+ "workspace.transition" : `start` ,
88+ "workspace_parameter.name" : `param` ,
89+ "workspace_parameter.description" : `param description` ,
90+ // TODO (sasswart): the cli doesn't support presets yet.
91+ // once it does, the value for workspace_parameter.value
92+ // will be the preset value.
93+ "workspace_parameter.value" : `param value` ,
94+ "workspace_parameter.icon" : `param icon` ,
95+ "workspace_preset.name" : `preset` ,
96+ "workspace_preset.parameters.param" : `preset param value` ,
8897 },
8998 },
9099 {
@@ -179,8 +188,18 @@ func TestIntegration(t *testing.T) {
179188 }
180189 _ , rc := execContainer (ctx , t , ctrID , fmt .Sprintf (`coder templates %s %s --directory /src/integration/%s --var output_path=/tmp/%s.json --yes` , templateCreateCmd , tt .name , tt .name , tt .name ))
181190 require .Equal (t , 0 , rc )
191+
192+ // Check if parameters.yaml exists
193+ _ , rc = execContainer (ctx , t , ctrID , fmt .Sprintf (`stat /src/integration/%s/parameters.yaml 2>/dev/null > /dev/null` , tt .name ))
194+ hasParameters := rc == 0
195+ var includeParameters string
196+ if hasParameters {
197+ // If it exists, include it in the create command
198+ includeParameters = fmt .Sprintf (`--rich-parameter-file /src/integration/%s/parameters.yaml` , tt .name )
199+ }
200+
182201 // Create a workspace
183- _ , rc = execContainer (ctx , t , ctrID , fmt .Sprintf (`coder create %s -t %s --yes` , tt .name , tt .name ))
202+ _ , rc = execContainer (ctx , t , ctrID , fmt .Sprintf (`coder create %s -t %s %s --yes` , tt .name , tt .name , includeParameters ))
184203 require .Equal (t , 0 , rc )
185204 // Fetch the output created by the template
186205 out , rc := execContainer (ctx , t , ctrID , fmt .Sprintf (`cat /tmp/%s.json` , tt .name ))
0 commit comments