Repository navigation
test(config-data): isolate environment and cache state - #148
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes address the state leak with restoration regressions and no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes order-dependent ConfigData tests by isolating system properties and refreshing Foundation’s cached environment, without changing production behavior.
Changes:
- Preserve and restore environment and profile properties.
- Run MockWebServer integration tests explicitly in
devmode. - Add regression tests for existing and unset properties.
| File | Description |
|---|---|
| apollo-client-config-data/src/test/java/com/ctrip/framework/apollo/config/data/integration/ConfigDataIntegrationTest.java | Uses dev mode and refreshes Foundation during setup and cleanup. |
| apollo-client-config-data/src/test/java/com/ctrip/framework/apollo/config/data/importer/PureApolloConfigTest.java | Restores original properties and refreshes cached environment state. |
| apollo-client-config-data/src/test/java/com/ctrip/framework/apollo/config/data/importer/PureApolloConfigIsolationTest.java | Verifies property and cached-environment restoration. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
============================================
+ Coverage 68.68% 71.55% +2.87%
- Complexity 1503 1667 +164
============================================
Files 212 225 +13
Lines 6396 6739 +343
Branches 647 688 +41
============================================
+ Hits 4393 4822 +429
+ Misses 1673 1562 -111
- Partials 330 355 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8985b7f2e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8985b7f to
cae9e78
Compare
cae9e78 to
5682d60
Compare
What's the purpose of this PR
Fix order-dependent ConfigData tests.
PureApolloConfigTestsetsenv=local; clearing the system property afterward did not refresh Foundation's cached server environment. When this test ran first,ConfigDataIntegrationTeststayed in local mode, skipped MockWebServer, and read missing cache files instead of the expected configuration. The integration fixture also needs its own disposable disk cache so MockWebServer responses do not read or overwrite a caller's cache.Which issue(s) this PR fixes:
No standalone issue. Discovered while reviewing #147. The same two failures also occur in the control CI run, whose code matches
mainexcept forCHANGES.md.Brief changelog
envandspring.profiles.activeproperties, and refresh Foundation's cached server provider during setup and teardown.devmode and refresh the provider when entering and leaving their environment scope.Validation
Using JDK 8: full suite reports 708 tests, 4 skipped, no failures or errors.
mvn -B clean test -P travis jacoco:report -Dmaven.gitcommitid.skip=truemvn -B spotless:check -Dmaven.gitcommitid.skip=truemvn -B -f apollo-compat-tests/pom.xml spotless:check -Dmaven.gitcommitid.skip=trueAdditional isolated-JVM checks cover the failing CI class order, integration-before-pure order, and integration tests starting with
-Denv=local.A disk-cache probe with both a caller-supplied
apollo.cache-dirandAPOLLO_CACHE_DIRfails before the cache fix: the integration tests pass but leave three fixture cache files in a caller directory. After the fix, both tests persist only inside one temporary directory, both caller directories remain unchanged, the original cache property is restored, and the temporary directory is removed. A separate intentional-failure probe also verifies directory cleanup and property restoration.spotless:check.