@@ -301,6 +301,14 @@ func TestWorkspaceBuildWithTags(t *testing.T) {
301
301
Key : "is_debug_build" ,
302
302
Value : `data.coder_parameter.is_debug_build.value == "true" ? "in-debug-mode" : "no-debug"` ,
303
303
},
304
+ {
305
+ Key : "variable_tag" ,
306
+ Value : `var.tag` ,
307
+ },
308
+ {
309
+ Key : "another_variable_tag" ,
310
+ Value : `var.tag2` ,
311
+ },
304
312
}
305
313
306
314
richParameters := []database.TemplateVersionParameter {
@@ -312,6 +320,11 @@ func TestWorkspaceBuildWithTags(t *testing.T) {
312
320
{Name : "number_of_oranges" , Type : "number" , Description : "This is fifth parameter" , Mutable : false , DefaultValue : "6" , Options : json .RawMessage ("[]" )},
313
321
}
314
322
323
+ templateVersionVariables := []database.TemplateVersionVariable {
324
+ {Name : "tag" , Description : "This is a variable tag" , TemplateVersionID : inactiveVersionID , Type : "string" , DefaultValue : "default-value" , Value : "my-value" },
325
+ {Name : "tag2" , Description : "This is another variable tag" , TemplateVersionID : inactiveVersionID , Type : "string" , DefaultValue : "default-value-2" , Value : "" },
326
+ }
327
+
315
328
buildParameters := []codersdk.WorkspaceBuildParameter {
316
329
{Name : "project" , Value : "foobar-foobaz" },
317
330
{Name : "is_debug_build" , Value : "true" },
@@ -326,24 +339,26 @@ func TestWorkspaceBuildWithTags(t *testing.T) {
326
339
withTemplate ,
327
340
withInactiveVersion (richParameters ),
328
341
withLastBuildFound ,
329
- withTemplateVersionVariables (inactiveVersionID , nil ),
342
+ withTemplateVersionVariables (inactiveVersionID , templateVersionVariables ),
330
343
withRichParameters (nil ),
331
344
withParameterSchemas (inactiveJobID , nil ),
332
345
withWorkspaceTags (inactiveVersionID , workspaceTags ),
333
346
withProvisionerDaemons ([]database.GetEligibleProvisionerDaemonsByProvisionerJobIDsRow {}),
334
347
335
348
// Outputs
336
349
expectProvisionerJob (func (job database.InsertProvisionerJobParams ) {
337
- asrt .Len (job .Tags , 10 )
350
+ asrt .Len (job .Tags , 12 )
338
351
339
352
expected := database.StringMap {
340
- "actually_no" : "false" ,
341
- "cluster_tag" : "best_developers" ,
342
- "fruits_tag" : "10" ,
343
- "is_debug_build" : "in-debug-mode" ,
344
- "project_tag" : "foobar-foobaz+12345" ,
345
- "team_tag" : "godzilla" ,
346
- "yes_or_no" : "true" ,
353
+ "actually_no" : "false" ,
354
+ "cluster_tag" : "best_developers" ,
355
+ "fruits_tag" : "10" ,
356
+ "is_debug_build" : "in-debug-mode" ,
357
+ "project_tag" : "foobar-foobaz+12345" ,
358
+ "team_tag" : "godzilla" ,
359
+ "yes_or_no" : "true" ,
360
+ "variable_tag" : "my-value" ,
361
+ "another_variable_tag" : "default-value-2" ,
347
362
348
363
"scope" : "user" ,
349
364
"version" : "inactive" ,
0 commit comments