TRUNK-6637: Restore runtime properties after InitializationFilterE2ETest#6112
Conversation
jwnasambu
left a comment
There was a problem hiding this comment.
@solomonfortune Thanks for this fix. Would you mind resolving the merge conflicts as well? Also, please run mvn spotless:apply to fix the formatting issues.
okay let me work on that as soon as possible |
8af2ccf to
b7239df
Compare
|
@jwnasambu the mvn spotless:apply built successfully and the merge conflits have also been resolved
|
|
@solomonfortune are all changes in this pull request required for the fix? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6112 +/- ##
============================================
+ Coverage 59.38% 59.45% +0.06%
- Complexity 9242 9245 +3
============================================
Files 693 693
Lines 37254 37254
Branches 5485 5485
============================================
+ Hits 22123 22149 +26
+ Misses 13138 13118 -20
+ Partials 1993 1987 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai fullreview |
|
@solomonfortune are all changes in this pull request required for the fix? |
The only changes strictly required for the fix are:
i thihnk the remaining changes are reformatting applied by mvn spotless:apply to bring the file in line with the project's code style. I ran spotless as requested by @jwnasambu. If you prefer a minimal diff without the formatting changes, I'm happy to revert the formatting and keep only the functional fix. |
|
@solomonfortune did you get a chance to look at this? https://opensource.com/article/18/6/anatomy-perfect-pull-request |
@dkayiwa I have really never. Let me take the opportunity to look at it right now |




Description of what I changed
In
InitializationFilterE2ETest.setup(), the@BeforeEachmethod calledContext.setRuntimeProperties(new Properties())but never restored the original value. The emptyPropertiesinstance leaked into subsequent test classes in the same Surefire fork that triggered a SpringApplicationContextload, causingSchedulerConfig/JobRunrConfigto build aDataSourcewith no URL or credentials. H2 then rejected the connection withWrong user name or password [28000-232], poisoning the cached context for all remaining tests.Fixed by saving
Context.getRuntimeProperties()before clearing it in@BeforeEach, and restoring it in@AfterEach. This preserves the test's ability to assert behaviour when runtime properties are absent, without leaking the empty state to other tests.Issue I worked on
see https://issues.openmrs.org/browse/TRUNK-6637
Checklist: I completed these to help reviewers :)
mvn clean packageright before creating this pull request and added all formatting changes to my commit.