Skip to content

Commit

Permalink
Improve test-level system property isolation for EnterpriseParallelJU…
Browse files Browse the repository at this point in the history
…nitClassRunner [HZ-4592] [HZ-4585] (hazelcast#1126)

Sets license key early so InheritableThreadLocal in
ThreadLocalProperties is not materialized too early and [shared by test
threads](https://github.com/hazelcast/hazelcast-enterprise/issues/7073#issuecomment-1995121029).

Fixes HZ-4592
Fixes https://github.com/hazelcast/hazelcast-enterprise/issues/7073
Fixes https://github.com/hazelcast/hazelcast-enterprise/issues/7072
(ultimately)

GitOrigin-RevId: 822a2249871fb71fbac65866f43c99465a79c1bd
  • Loading branch information
k-jamroz authored and actions-user committed Mar 18, 2024
1 parent 7578730 commit 88080c1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ public void evaluate() throws Throwable {
// save the current system properties
Properties currentSystemProperties = System.getProperties();
try {
// use thread-local based system properties so parallel tests don't effect each other
// use thread-local based system properties so parallel tests don't affect each other
// Note that proper isolation requires that no other element of the test framework accesses
// system properties too early, between creation of ThreadLocalProperties and starting test
// thread. Otherwise, many threads will inherit shared Properties instance.
System.setProperties(new ThreadLocalProperties(currentSystemProperties));
HazelcastParallelClassRunner.super.childrenInvoker(notifier).evaluate();
// wait for all child threads (tests) to complete
Expand Down

0 comments on commit 88080c1

Please sign in to comment.