Skip to content
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 flaky test issue 4997 #4998

Merged
merged 2 commits into from
Oct 20, 2023
Merged

Conversation

ThugJudy
Copy link
Contributor

What's the purpose of this PR

fix flaky test com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCacheTest#testAppNamespace

Which issue(s) this PR fixes:

Fixes #4997

Brief changelog

To address this issue effectively, we propose sorting the values in the line 197 of AppNamespaceServiceWithCache to be inserted into the list.
List ids = appNamespaceIdCache.keySet().stream().sorted().collect(Collectors.toList());
This approach ensures the stability of the test, by making sure that the list has a maintained order, thereby mitigating any potential flakiness.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

…mespaceServiceWithCacheTest#testAppNamespace
@github-actions
Copy link

github-actions bot commented Oct 18, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ThugJudy
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

Merging #4998 (9205718) into master (5e49df6) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #4998      +/-   ##
============================================
- Coverage     48.94%   48.94%   -0.01%     
- Complexity     1781     1783       +2     
============================================
  Files           348      348              
  Lines         10991    10991              
  Branches       1095     1095              
============================================
- Hits           5380     5379       -1     
- Misses         5281     5284       +3     
+ Partials        330      328       -2     
Files Coverage Δ
...gservice/service/AppNamespaceServiceWithCache.java 81.61% <100.00%> (ø)

... and 4 files with indirect coverage changes

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam merged commit a632cc1 into apolloconfig:master Oct 20, 2023
11 of 12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2023
@nobodyiam nobodyiam added this to the 2.2.0 milestone Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky JUnit test testAppNamespace in AppNamespaceServiceWithCacheTest.java of module apollo-configservice
2 participants