Skip to content

Commit 95f5637

Browse files
Fix executor shutdown race in PII masking tests
Remove simulateInitializationComplete() from PII masking tests that only verify queue contents. The call triggers processAll() -> shutdownBackgroundExecutorAsync() which can race with the next test's executor setup, causing testInitializeInBackground_WithConfig to fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7772106 commit 95f5637

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

iterableapi/src/test/java/com/iterable/iterableapi/IterableAsyncInitializationTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,9 @@ public void testPIIMasking_EmailMasked() throws InterruptedException {
10791079
}
10801080
}
10811081

1082-
// Complete initialization
1083-
IterableBackgroundInitializer.simulateInitializationComplete();
1082+
// No need to call simulateInitializationComplete() here — tearDown resets state.
1083+
// Calling it would trigger processAll() -> shutdownBackgroundExecutorAsync() which
1084+
// can race with the next test's executor setup.
10841085
}
10851086

10861087
@Test
@@ -1153,8 +1154,7 @@ public void testPIIMasking_AuthTokenMasked() throws InterruptedException {
11531154
}
11541155
}
11551156

1156-
// Complete initialization
1157-
IterableBackgroundInitializer.simulateInitializationComplete();
1157+
// No need to call simulateInitializationComplete() — tearDown resets state.
11581158
}
11591159

11601160
@Test
@@ -1207,8 +1207,7 @@ public void testPIIMasking_VerifyExactFormat() throws InterruptedException {
12071207
assertTrue("UserId 'user_123_abc' should be masked to 'u***'", foundUserId1Masked);
12081208
assertTrue("Email 'a@b.com' should be masked to 'a***'", foundEmail2Masked);
12091209

1210-
// Complete initialization
1211-
IterableBackgroundInitializer.simulateInitializationComplete();
1210+
// No need to call simulateInitializationComplete() — tearDown resets state.
12121211
}
12131212

12141213
// ========================================

0 commit comments

Comments
 (0)