mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Improve diagnostics for flaky ParallelApplicationEventsIntegrationTests
This commit is contained in:
+5
-2
@@ -75,13 +75,16 @@ class ParallelApplicationEventsIntegrationTests {
|
||||
assertThat(payloads).hasSize(10);
|
||||
assertThat(testNames).hasSize(10);
|
||||
|
||||
int availableProcessors = Runtime.getRuntime().availableProcessors();
|
||||
// Skip the following assertion entirely if too few processors are available
|
||||
// to the current JVM.
|
||||
if (Runtime.getRuntime().availableProcessors() >= 4) {
|
||||
if (availableProcessors >= 6) {
|
||||
// There are probably 10 different thread names on a developer's machine,
|
||||
// but we really just want to assert that at least two different threads
|
||||
// were used, since the CI server often has fewer threads available.
|
||||
assertThat(threadNames).hasSizeGreaterThanOrEqualTo(2);
|
||||
assertThat(threadNames)
|
||||
.as("number of threads used with " + availableProcessors + " available processors")
|
||||
.hasSizeGreaterThanOrEqualTo(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user