Fixes testUpdateBranchGrayRulesWithUpdateOnce#4599
Fixes testUpdateBranchGrayRulesWithUpdateOnce#4599nobodyiam merged 5 commits intoapolloconfig:masterfrom
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. |
What's the purpose of this PR
Fix test
testUpdateBranchGrayRulesWithUpdateOnceWhich 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.