apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.95k stars 10.19k forks source link

fix flaky test issue 4997 #4998

Closed ThugJudy closed 8 months ago

ThugJudy commented 8 months ago

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:

github-actions[bot] commented 8 months ago

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

ThugJudy commented 8 months ago

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

codecov[bot] commented 8 months ago

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