Fix set-namespace to fail on invalid configuration#1254
Open
aravindtga wants to merge 1 commit into
Open
Conversation
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
✅ Deploy Preview for krm-function-catalog canceled.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Changes the set-namespace function to return a failure exit code when the function configuration is invalid or missing, instead of silently succeeding.
Changes:
- Return
false(failure) fromRunwhentc.Configfails, so the function exits non-zero. - Updated expected test results to reflect the new non-zero exit code and error output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| functions/go/set-namespace/transformer/namespace.go | Return false on config error to signal failure. |
| functions/go/set-namespace/tests/no-fnconfig-resource/.expected/results.yaml | Updated expected exitCode/stderr to 1. |
| functions/go/set-namespace/tests/no-fnconfig-resource/.expected/diff.patch | Updated expected Kptfile rendered status to RenderFailed. |
| functions/go/set-namespace/tests/no-fnconfig-resource/.expected/config.yaml | New expected config with exitCode 1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
set-namespacewas exiting 0 and reporting [PASS] when configuration was invalid (e.g., empty namespace), while simultaneously emitting an error-severity result.Closes #4547
Root cause:
The Run function in transformer/namespace.go returned true, nil on config error, signaling success to the framework:
Fix:
Changed return true, nil to return false, nil so the framework correctly reports the function as failed (exit code 1, [FAIL]).
Before:
After:
Testing: