Skip to content

fix: set preset parameters in the API rather than the frontend #17403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 16, 2025
Prev Previous commit
add the option to specify preset parameters in wsbuilder_test
  • Loading branch information
SasSwart committed Apr 16, 2025
commit a66c533684c6b4e4a5db56211e19a07c4008c081
9 changes: 6 additions & 3 deletions coderd/wsbuilder/wsbuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,10 @@ func TestWorkspaceBuildWithPreset(t *testing.T) {
// Inputs
withTemplate,
withActiveVersion(nil),
withTemplateVersionPreset(presetID),
// building workspaces using presets with different combinations of parameters
// is tested at the API layer, in TestWorkspace. Here, it is sufficient to
// test that the preset is used when provided.
withTemplateVersionPresetParameters(presetID, nil),
withLastBuildNotFound,
withTemplateVersionVariables(activeVersionID, nil),
withParameterSchemas(activeJobID, nil),
Expand Down Expand Up @@ -961,9 +964,9 @@ func withInactiveVersion(params []database.TemplateVersionParameter) func(mTx *d
}
}

func withTemplateVersionPreset(presetID uuid.UUID) func(mTx *dbmock.MockStore) {
func withTemplateVersionPresetParameters(presetID uuid.UUID, params []database.TemplateVersionPresetParameter) func(mTx *dbmock.MockStore) {
return func(mTx *dbmock.MockStore) {
mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(nil, nil)
mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(params, nil)
}
}

Expand Down
Loading