-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Fixes testUpdateBranchGrayRulesWithUpdateOnce #4599
Fixes testUpdateBranchGrayRulesWithUpdateOnce #4599
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Sorry I closed my previous PR by accident. The reason I didn't use GrayReleaseRuleItemTransformer#batchTransformFromJSON is once we transform it into object, the object's |
I have read the CLA Document and I hereby sign the CLA |
recheck |
Codecov Report
@@ Coverage Diff @@
## master #4599 +/- ##
=========================================
Coverage 47.23% 47.23%
Complexity 1649 1649
=========================================
Files 347 347
Lines 10631 10631
Branches 1053 1053
=========================================
Hits 5022 5022
Misses 5306 5306
Partials 303 303
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
Outdated
Show resolved
Hide resolved
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
Outdated
Show resolved
Hide resolved
607f035
to
e0499a8
Compare
The unit test failed, which seems related to the line of code Set<GrayReleaseRuleItemDTO> contextRules = GrayReleaseRuleItemTransformer.batchTransformFromJSON(context.substring(context.indexOf("["),context.lastIndexOf("]")+1)); |
Yeah that seems to be where the problem lies. I have changed it to transfer the context to a map struct to avoid hardcoding. Now it should work fine. |
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
Outdated
Show resolved
Hide resolved
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
What's the purpose of this PR
Fix test
testUpdateBranchGrayRulesWithUpdateOnce
Which issue(s) this PR fixes:
Fixes the issue that causes flaky tests. The current test may lead to inconsistent ordering of stringified JSON objects and the test may fail sometimes. To fix the test and make it consistent, I select all the elements in the list and see whether the release history contains those elements. In this case, the ordering of the elements doesn't matter and won't cause failure.
Brief changelog
Added containRule function.