@@ -57,6 +57,7 @@ func TestBuilder_NoOptions(t *testing.T) {
57
57
mDB := expectDB (t ,
58
58
// Inputs
59
59
withTemplate ,
60
+ withTerraformValuesErrNoRows ,
60
61
withInactiveVersion (nil ),
61
62
withLastBuildFound ,
62
63
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -113,6 +114,7 @@ func TestBuilder_Initiator(t *testing.T) {
113
114
mDB := expectDB (t ,
114
115
// Inputs
115
116
withTemplate ,
117
+ withTerraformValuesErrNoRows ,
116
118
withInactiveVersion (nil ),
117
119
withLastBuildFound ,
118
120
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -159,6 +161,7 @@ func TestBuilder_Baggage(t *testing.T) {
159
161
mDB := expectDB (t ,
160
162
// Inputs
161
163
withTemplate ,
164
+ withTerraformValuesErrNoRows ,
162
165
withInactiveVersion (nil ),
163
166
withLastBuildFound ,
164
167
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -197,6 +200,7 @@ func TestBuilder_Reason(t *testing.T) {
197
200
mDB := expectDB (t ,
198
201
// Inputs
199
202
withTemplate ,
203
+ withTerraformValuesErrNoRows ,
200
204
withInactiveVersion (nil ),
201
205
withLastBuildFound ,
202
206
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -235,6 +239,7 @@ func TestBuilder_ActiveVersion(t *testing.T) {
235
239
mDB := expectDB (t ,
236
240
// Inputs
237
241
withTemplate ,
242
+ withTerraformValuesErrNoRows ,
238
243
withActiveVersion (nil ),
239
244
withLastBuildNotFound ,
240
245
withTemplateVersionVariables (activeVersionID ,nil ),
@@ -338,6 +343,7 @@ func TestWorkspaceBuildWithTags(t *testing.T) {
338
343
mDB := expectDB (t ,
339
344
// Inputs
340
345
withTemplate ,
346
+ withTerraformValuesErrNoRows ,
341
347
withInactiveVersion (richParameters ),
342
348
withLastBuildFound ,
343
349
withTemplateVersionVariables (inactiveVersionID ,templateVersionVariables ),
@@ -433,6 +439,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
433
439
mDB := expectDB (t ,
434
440
// Inputs
435
441
withTemplate ,
442
+ withTerraformValuesErrNoRows ,
436
443
withInactiveVersion (richParameters ),
437
444
withLastBuildFound ,
438
445
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -480,6 +487,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
480
487
mDB := expectDB (t ,
481
488
// Inputs
482
489
withTemplate ,
490
+ withTerraformValuesErrNoRows ,
483
491
withInactiveVersion (richParameters ),
484
492
withLastBuildFound ,
485
493
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -533,6 +541,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
533
541
mDB := expectDB (t ,
534
542
// Inputs
535
543
withTemplate ,
544
+ withTerraformValuesErrNoRows ,
536
545
withInactiveVersion (richParameters ),
537
546
withLastBuildFound ,
538
547
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -565,6 +574,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
565
574
mDB := expectDB (t ,
566
575
// Inputs
567
576
withTemplate ,
577
+ withTerraformValuesErrNoRows ,
568
578
withInactiveVersion (richParameters ),
569
579
withLastBuildFound ,
570
580
withTemplateVersionVariables (inactiveVersionID ,nil ),
@@ -617,6 +627,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
617
627
mDB := expectDB (t ,
618
628
// Inputs
619
629
withTemplate ,
630
+ withTerraformValuesErrNoRows ,
620
631
withActiveVersion (version2params ),
621
632
withLastBuildFound ,
622
633
withTemplateVersionVariables (activeVersionID ,nil ),
@@ -680,6 +691,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
680
691
mDB := expectDB (t ,
681
692
// Inputs
682
693
withTemplate ,
694
+ withTerraformValuesErrNoRows ,
683
695
withActiveVersion (version2params ),
684
696
withLastBuildFound ,
685
697
withTemplateVersionVariables (activeVersionID ,nil ),
@@ -741,6 +753,7 @@ func TestWorkspaceBuildWithRichParameters(t *testing.T) {
741
753
mDB := expectDB (t ,
742
754
// Inputs
743
755
withTemplate ,
756
+ withTerraformValuesErrNoRows ,
744
757
withActiveVersion (version2params ),
745
758
withLastBuildFound ,
746
759
withTemplateVersionVariables (activeVersionID ,nil ),
@@ -788,6 +801,7 @@ func TestWorkspaceBuildWithPreset(t *testing.T) {
788
801
mDB := expectDB (t ,
789
802
// Inputs
790
803
withTemplate ,
804
+ withTerraformValuesErrNoRows ,
791
805
withActiveVersion (nil ),
792
806
// building workspaces using presets with different combinations of parameters
793
807
// is tested at the API layer, in TestWorkspace. Here, it is sufficient to
@@ -902,6 +916,12 @@ func withTemplate(mTx *dbmock.MockStore) {
902
916
},nil )
903
917
}
904
918
919
+ func withTerraformValuesErrNoRows (mTx * dbmock.MockStore ) {
920
+ mTx .EXPECT ().GetTemplateVersionTerraformValues (gomock .Any (),gomock .Any ()).
921
+ Times (1 ).
922
+ Return (database.TemplateVersionTerraformValue {},sql .ErrNoRows )
923
+ }
924
+
905
925
// withInTx runs the given functions on the same db mock.
906
926
func withInTx (mTx * dbmock.MockStore ) {
907
927
mTx .EXPECT ().InTx (gomock .Any (),gomock .Any ()).Times (1 ).DoAndReturn (