Skip to content

Commit a66c533

Browse files
committed
add the option to specify preset parameters in wsbuilder_test
1 parent 9bdb8ce commit a66c533

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

coderd/wsbuilder/wsbuilder_test.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,10 @@ func TestWorkspaceBuildWithPreset(t *testing.T) {
789789
// Inputs
790790
withTemplate,
791791
withActiveVersion(nil),
792-
withTemplateVersionPreset(presetID),
792+
// building workspaces using presets with different combinations of parameters
793+
// is tested at the API layer, in TestWorkspace. Here, it is sufficient to
794+
// test that the preset is used when provided.
795+
withTemplateVersionPresetParameters(presetID, nil),
793796
withLastBuildNotFound,
794797
withTemplateVersionVariables(activeVersionID, nil),
795798
withParameterSchemas(activeJobID, nil),
@@ -961,9 +964,9 @@ func withInactiveVersion(params []database.TemplateVersionParameter) func(mTx *d
961964
}
962965
}
963966

964-
func withTemplateVersionPreset(presetID uuid.UUID) func(mTx *dbmock.MockStore) {
967+
func withTemplateVersionPresetParameters(presetID uuid.UUID, params []database.TemplateVersionPresetParameter) func(mTx *dbmock.MockStore) {
965968
return func(mTx *dbmock.MockStore) {
966-
mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(nil, nil)
969+
mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(params, nil)
967970
}
968971
}
969972

0 commit comments

Comments
 (0)