@@ -60,6 +60,7 @@ func TestBuilder_NoOptions(t *testing.T) {
60
60
withLastBuildFound ,
61
61
withRichParameters (nil ),
62
62
withParameterSchemas (inactiveJobID , nil ),
63
+ withWorkspaceTags (inactiveVersionID , nil ),
63
64
64
65
// Outputs
65
66
expectProvisionerJob (func (job database.InsertProvisionerJobParams ) {
@@ -112,6 +113,7 @@ func TestBuilder_Initiator(t *testing.T) {
112
113
withLastBuildFound ,
113
114
withRichParameters (nil ),
114
115
withParameterSchemas (inactiveJobID , nil ),
116
+ withWorkspaceTags (inactiveVersionID , nil ),
115
117
116
118
// Outputs
117
119
expectProvisionerJob (func (job database.InsertProvisionerJobParams ) {
@@ -154,6 +156,7 @@ func TestBuilder_Baggage(t *testing.T) {
154
156
withLastBuildFound ,
155
157
withRichParameters (nil ),
156
158
withParameterSchemas (inactiveJobID , nil ),
159
+ withWorkspaceTags (inactiveVersionID , nil ),
157
160
158
161
// Outputs
159
162
expectProvisionerJob (func (job database.InsertProvisionerJobParams ) {
@@ -188,6 +191,7 @@ func TestBuilder_Reason(t *testing.T) {
188
191
withLastBuildFound ,
189
192
withRichParameters (nil ),
190
193
withParameterSchemas (inactiveJobID , nil ),
194
+ withWorkspaceTags (inactiveVersionID , nil ),
191
195
192
196
// Outputs
193
197
expectProvisionerJob (func (job database.InsertProvisionerJobParams ) {
@@ -813,6 +817,18 @@ func withRichParameters(params []database.WorkspaceBuildParameter) func(mTx *dbm
813
817
}
814
818
}
815
819
820
+ func withWorkspaceTags (versionID uuid.UUID , tags []database.TemplateVersionWorkspaceTag ) func (mTx * dbmock.MockStore ) {
821
+ return func (mTx * dbmock.MockStore ) {
822
+ c := mTx .EXPECT ().GetTemplateVersionWorkspaceTags (gomock .Any (), versionID ).
823
+ Times (1 )
824
+ if len (tags ) > 0 {
825
+ c .Return (tags , nil )
826
+ } else {
827
+ c .Return (nil , sql .ErrNoRows )
828
+ }
829
+ }
830
+ }
831
+
816
832
// Since there is expected to be only one each of job, build, and build-parameters inserted, instead
817
833
// of building matchers, we match any call and then assert its parameters. This will feel
818
834
// more familiar to the way we write other tests.
0 commit comments