-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix reject
needing both current and previous ids
#5263
Fix reject
needing both current and previous ids
#5263
Conversation
Welcome @bugoverdose! |
Hi @bugoverdose. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can you take a look at https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/replacementtransformer_test.go and see if the test infrastructure there is sufficient for you to add a test? For bug fixes, we usually like to have the first commit add a test, but show the incorrect behavior (so that it passes). This helps to demonstrate what the problem is. |
/ok-to-test |
34c8c0d
to
484e93c
Compare
This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
484e93c
to
9f1d5ac
Compare
I changed it from "from" to "fixes".
I couldn't really understand the test setup, but it worked. Thanks.
For a second, I thought you wanted me to commit a failing test so that it would be like Test Driven Development, but I guess it makes more sense to do it the way you explained. Basically, it shows the change in implementation. I force pushed the commits to match the order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Thanks for the fix.
Would you be willing to update the replacements
docs to explain the behavior? I think it would be nice to have a sentence or two under targets somewhere that explains that selection and rejection will match a resource by any of its previous ids. The source for those docs live here, and we can merge a docs update with the next release.
@@ -546,3 +546,71 @@ metadata: | |||
name: red-dc6gc5btkc | |||
`) | |||
} | |||
|
|||
func TestReplacementTransformerWithSuffixTransformerAndReject(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test looks good! Thanks for adding this.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bugoverdose, natasha41575 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fixes #5241
The bug is really well explained in the issue, so please check it to understand the context.
Bug Explanation
In
applyReplacement
, we apply replacement on the selected node if it is not rejected.When prefix or suffix transformer is applied on a resource, the id of the resource is changed.
Problem: We were checking both of the ids, previous and current, and if any of it was not rejected, we applied the replacement.
Fix
I just made it apply replacement only if none of the ids (previous and current) were rejected.
Tests
I think we need a E2E test for this.
TestFilter
atreplacement_test.go
isn't enough for this case.Is there a way to test multiple Filters?
Another Solutions