Skip to content

Commit

Permalink
[test] Observe more outcomes in DefaultTestSubscriberTest (#3766)
Browse files Browse the repository at this point in the history
Increased the number of loops in the tests to provide more diversity and
avoid all cases being "interesting". Also, the assertion assumes all
results can be interesting, not just a subset.

Resolves #3749
  • Loading branch information
chemicL committed Mar 20, 2024
1 parent 0c0493a commit 95b2ee7
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2021-2024 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,7 @@
class DefaultTestSubscriberTest {

private static final Logger LOGGER = Loggers.getLogger(DefaultTestSubscriberTest.class);
private static final int RACE_DETECTION_LOOPS = 100;
private static final int RACE_DETECTION_LOOPS = 1000;

@Nullable
static Throwable captureThrow(Runnable r) {
Expand Down Expand Up @@ -1125,7 +1125,7 @@ void raceDetectionOnNextOnNext() {
}
}
LOGGER.info("raceDetectionOnNextOnNext interesting {} / {}", interesting, RACE_DETECTION_LOOPS);
assertThat(interesting).as("asserts racy cases").isLessThan(RACE_DETECTION_LOOPS);
assertThat(interesting).as("asserts racy cases").isLessThanOrEqualTo(RACE_DETECTION_LOOPS);
}

@Test
Expand Down Expand Up @@ -1166,7 +1166,7 @@ void raceDetectionOnNextOnComplete() {
}
}
LOGGER.info("raceDetectionOnNextOnComplete interesting {} / {}", interesting, loops);
assertThat(interesting).as("asserts racy cases").isLessThan(loops);
assertThat(interesting).as("asserts racy cases").isLessThanOrEqualTo(loops);
}

@Test
Expand Down Expand Up @@ -1207,7 +1207,7 @@ void raceDetectionOnNextOnError() {
}
}
LOGGER.info("raceDetectionOnNextOnError interesting {} / {}", interesting, RACE_DETECTION_LOOPS);
assertThat(interesting).as("asserts racy cases").isLessThan(RACE_DETECTION_LOOPS);
assertThat(interesting).as("asserts racy cases").isLessThanOrEqualTo(RACE_DETECTION_LOOPS);
}

@RepeatedTest(100)
Expand Down

0 comments on commit 95b2ee7

Please sign in to comment.