You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(planpreview): add unit tests for builder.buildApp - #7665
Adds unit tests for (*builder).buildApp in pkg/app/pipedv1/planpreview/builder_test.go and removes the resolved // TODO: add tests comment in pkg/app/pipedv1/planpreview/builder.go.
Covered scenarios:
Non-NotFound error when fetching the last successful deployment
Failure when getting the target deploy source
Failure when the target application config is invalid
Failure when retrieving plugin clients from the registry
First deployment (codes.NotFound) succeeding with QUICK_SYNC and nil running deploy source
Subsequent deployment passing the running deploy source and skipping plugins that return codes.Unimplemented
Error aggregation when plugin.GetPlanPreview returns an error
Fallback PluginNames = []string{"<unknown>"} when no plugins execute
Why we need it:
pkg/app/pipedv1/planpreview/builder_test.go previously only covered listApplications, leaving buildApp untested.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The test covers only one failing plugin, leaving error aggregation unprotected; it should verify that failures from two distinct plugins both appear in res.Error.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The tests do not exercise plugin-selected strategies because the configuration has no pipeline stages, leaving a regression that always selects QUICK_SYNC undetected.
These strategy responses are never exercised: validAppConfig has no pipeline stages, so controller.DetermineStrategy returns QUICK_SYNC before calling either plugin. The suite therefore does not detect a regression where buildApp always selects QUICK_SYNC instead of propagating the plugin-selected strategy. Please add a pipeline-configured subsequent-deployment case with a plugin returning PIPELINE, and assert that DetermineStrategy is called and that res.SyncStrategy matches its response.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The test omits assertions for res.NoChange, allowing an aggregation bug that updates the plugin response instead of the application result to pass undetected.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Propagate plugin NoChange status to the application result
The active plugin returns NoChange: true, but this test never checks res.NoChange. It therefore passes despite buildApp leaving that field false: builder.go:308 updates the plugin response instead of the application result. Please assert that the unchanged-only result has NoChange == true, add a corresponding false assertion for the changed-result fixture, and correct the aggregation so these assertions pass.
Review effort: Balanced
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
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.
What this PR does:
Adds unit tests for
(*builder).buildAppinpkg/app/pipedv1/planpreview/builder_test.goand removes the resolved// TODO: add testscomment inpkg/app/pipedv1/planpreview/builder.go.Covered scenarios:
NotFounderror when fetching the last successful deploymentcodes.NotFound) succeeding withQUICK_SYNCandnilrunning deploy sourcecodes.Unimplementedplugin.GetPlanPreviewreturns an errorPluginNames = []string{"<unknown>"}when no plugins executeWhy we need it:
pkg/app/pipedv1/planpreview/builder_test.gopreviously only coveredlistApplications, leavingbuildAppuntested.Which issue(s) this PR fixes:
Fixes #7664
Does this PR introduce a user-facing change?:
No.
Screenshots/Videos (for documentation or website changes):
N/A