Skip to content

Commit

Permalink
1.x: Give more time to OperatorSwitchTest.switchAsyncHeavily (Reactiv…
Browse files Browse the repository at this point in the history
…eX#3897)

* 1.x: Give more time to OperatorSwitchTest.switchAsyncHeavily

* Also print last seen how long time ago
  • Loading branch information
akarnokd committed Apr 29, 2016
1 parent 89fd2dd commit cf63347
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/java/rx/internal/operators/OperatorSwitchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,15 @@ public void switchAsyncHeavily() {

final Queue<Throwable> q = new ConcurrentLinkedQueue<Throwable>();

final long[] lastSeen = { 0L };

final int j = i;
TestSubscriber<Integer> ts = new TestSubscriber<Integer>(i) {
int count;
@Override
public void onNext(Integer t) {
super.onNext(t);
lastSeen[0] = System.currentTimeMillis();
if (++count == j) {
count = 0;
requestMore(j);
Expand All @@ -867,13 +870,13 @@ public void call(Throwable e) {
.timeout(10, TimeUnit.SECONDS)
.subscribe(ts);

ts.awaitTerminalEvent(30, TimeUnit.SECONDS);
ts.awaitTerminalEvent(45, TimeUnit.SECONDS);
if (!q.isEmpty()) {
throw new AssertionError("Dropped exceptions", new CompositeException(q));
}
ts.assertNoErrors();
if (ts.getOnCompletedEvents().size() == 0) {
fail("switchAsyncHeavily timed out @ " + j + " (" + ts.getOnNextEvents().size() + " onNexts received)");
fail("switchAsyncHeavily timed out @ " + j + " (" + ts.getOnNextEvents().size() + " onNexts received, last was " + (System.currentTimeMillis() - lastSeen[0]) + " ms ago");
}
}
}
Expand Down

0 comments on commit cf63347

Please sign in to comment.