Skip to content

Commit 06d90da

Browse files
committed
Merge pull request #3085 from davidmoten/on-drop-test-fix
break tests as approach timeout so that don't fail on slow machines
2 parents 0cf6e64 + 8d1cecc commit 06d90da

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/test/java/rx/BackpressureTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,13 @@ public void testFirehoseFailsAsExpected() {
443443

444444
@Test(timeout = 10000)
445445
public void testOnBackpressureDrop() {
446+
long t = System.currentTimeMillis();
446447
for (int i = 0; i < 100; i++) {
448+
// stop the test if we are getting close to the timeout because slow machines
449+
// may not get through 100 iterations
450+
if (System.currentTimeMillis() - t > TimeUnit.SECONDS.toMillis(9)) {
451+
break;
452+
}
447453
int NUM = (int) (RxRingBuffer.SIZE * 1.1); // > 1 so that take doesn't prevent buffer overflow
448454
AtomicInteger c = new AtomicInteger();
449455
TestSubscriber<Integer> ts = new TestSubscriber<Integer>();

src/test/java/rx/internal/operators/OperatorMergeMaxConcurrentTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ public void testSimpleOneLessAsyncLoop() {
224224
}
225225
@Test(timeout = 10000)
226226
public void testSimpleOneLessAsync() {
227+
long t = System.currentTimeMillis();
227228
for (int i = 2; i < 50; i++) {
229+
if (System.currentTimeMillis() - t > TimeUnit.SECONDS.toMillis(9)) {
230+
break;
231+
}
228232
TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
229233
List<Observable<Integer>> sourceList = new ArrayList<Observable<Integer>>(i);
230234
Set<Integer> expected = new HashSet<Integer>(i);

0 commit comments

Comments
 (0)