Skip to content

Commit 676ed5b

Browse files
committed
Remove max time on pubsub test.
Instead use 95% delivery of messages
1 parent f092411 commit 676ed5b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/test/java/io/ipfs/api/APITest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,18 +418,14 @@ public void pubsubSynchronous() throws Exception {
418418
throw new RuntimeException(e);}
419419
}).start();
420420

421-
long start = System.currentTimeMillis();
422-
for (int i=1; i < 100; ) {
423-
long t1 = System.currentTimeMillis();
421+
int nMessages = 100;
422+
for (int i = 1; i < nMessages; ) {
424423
ipfs.pubsub.pub(topic, "Hello!");
425424
if (res.size() >= i) {
426-
long t2 = System.currentTimeMillis();
427-
System.out.println("pub => sub took " + (t2 - t1));
428425
i++;
429426
}
430427
}
431-
long duration = System.currentTimeMillis() - start;
432-
Assert.assertTrue("Fast synchronous pub-sub", duration < 4000);
428+
Assert.assertTrue(res.size() > nMessages - 5); // pubsub is not reliable so it loses messages
433429
}
434430

435431
@Test

0 commit comments

Comments
 (0)