Conversation
|
|
||
| func withTemplateVersionPreset(presetID uuid.UUID) func(mTx *dbmock.MockStore) { | ||
| return func(mTx *dbmock.MockStore) { | ||
| mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(nil, nil) |
Contributor
There was a problem hiding this comment.
I don't understand the value of returning nil, nil here; this won't execute your new codepath in findNewBuildParameterValue. Can you help me understand pls?
| name: "Single Preset - No Preset Parameters But With Template Parameters", | ||
| presets: []*proto.Preset{emptyPreset}, | ||
| templateVersionParameters: templateVersionParameters, | ||
| selectedPresetIndex: ptr.Ref(0), |
Contributor
There was a problem hiding this comment.
What about instead just doing something like this?
Suggested change
| selectedPresetIndex: ptr.Ref(0), | |
| selectedPreset: &emptyPreset, |
| presets: []*proto.Preset{}, | ||
| templateVersionParameters: []*proto.RichParameter{}, | ||
| selectedPresetIndex: -1, | ||
| templateVersionParameters: templateVersionParameters, |
Contributor
There was a problem hiding this comment.
Implementation doesn't seem to match the name
Contributor
dannykopping
left a comment
There was a problem hiding this comment.
Tests read much better now, thanks 👍
|
|
||
| // Test Utility variables | ||
| templateVersionParameters := []*proto.RichParameter{ | ||
| {Name: "param1", Type: "string", Required: false}, |
Contributor
There was a problem hiding this comment.
Only testing with unrequired params might introduce interesting blindspots, no?
dannykopping
approved these changes
Apr 16, 2025
Contributor
|
Please update the referenced PR in the description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up from a previous Pull Request required some additional testing of Presets from the API perspective.
In the process of adding the new tests, I updated the API to enforce preset parameter values based on the selected preset instead of trusting whichever frontend makes the request. This avoids errors scenarios in prebuilds where a prebuild might expect a certain preset but find a different set of actual parameter values.