Skip to content

Commit f61b229

Browse files
authored
2.x: Fix flaky MaybeFromCallableTest.noErrorLoss (#5541)
* 2.x: Fix flaky MaybeFromCallableTest.noErrorLoss * Fix the same error in 2 other Maybe tests.
1 parent 5242cf3 commit f61b229

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/test/java/io/reactivex/internal/operators/maybe/MaybeFromActionTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,14 @@ public void noErrorLoss() throws Exception {
135135
@Override
136136
public void run() throws Exception {
137137
cdl1.countDown();
138-
cdl2.await();
138+
cdl2.await(5, TimeUnit.SECONDS);
139139
}
140140
}).subscribeOn(Schedulers.single()).test();
141141

142142
assertTrue(cdl1.await(5, TimeUnit.SECONDS));
143143

144144
to.cancel();
145145

146-
cdl2.countDown();
147-
148146
int timeout = 10;
149147

150148
while (timeout-- > 0 && errors.isEmpty()) {

src/test/java/io/reactivex/internal/operators/maybe/MaybeFromCallableTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void noErrorLoss() throws Exception {
138138
@Override
139139
public Integer call() throws Exception {
140140
cdl1.countDown();
141-
cdl2.await();
141+
cdl2.await(5, TimeUnit.SECONDS);
142142
return 1;
143143
}
144144
}).subscribeOn(Schedulers.single()).test();
@@ -147,8 +147,6 @@ public Integer call() throws Exception {
147147

148148
to.cancel();
149149

150-
cdl2.countDown();
151-
152150
int timeout = 10;
153151

154152
while (timeout-- > 0 && errors.isEmpty()) {

src/test/java/io/reactivex/internal/operators/maybe/MaybeFromRunnableTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void noErrorLoss() throws Exception {
134134
public void run() {
135135
cdl1.countDown();
136136
try {
137-
cdl2.await();
137+
cdl2.await(5, TimeUnit.SECONDS);
138138
} catch (InterruptedException ex) {
139139
throw new RuntimeException(ex);
140140
}
@@ -145,8 +145,6 @@ public void run() {
145145

146146
to.cancel();
147147

148-
cdl2.countDown();
149-
150148
int timeout = 10;
151149

152150
while (timeout-- > 0 && errors.isEmpty()) {

0 commit comments

Comments
 (0)