Skip to content

Commit 5d70aaa

Browse files
committed
Improve diagnostics for flaky ParallelApplicationEventsIntegrationTests
1 parent 566ff54 commit 5d70aaa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-test/src/test/java/org/springframework/test/context/junit/jupiter/event/ParallelApplicationEventsIntegrationTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,16 @@ void executeTestsInParallel(Class<?> testClass) {
7575
assertThat(payloads).hasSize(10);
7676
assertThat(testNames).hasSize(10);
7777

78+
int availableProcessors = Runtime.getRuntime().availableProcessors();
7879
// Skip the following assertion entirely if too few processors are available
7980
// to the current JVM.
80-
if (Runtime.getRuntime().availableProcessors() >= 4) {
81+
if (availableProcessors >= 6) {
8182
// There are probably 10 different thread names on a developer's machine,
8283
// but we really just want to assert that at least two different threads
8384
// were used, since the CI server often has fewer threads available.
84-
assertThat(threadNames).hasSizeGreaterThanOrEqualTo(2);
85+
assertThat(threadNames)
86+
.as("number of threads used with " + availableProcessors + " available processors")
87+
.hasSizeGreaterThanOrEqualTo(2);
8588
}
8689
}
8790

0 commit comments

Comments
 (0)