Skip to content

Commit cd50315

Browse files
committed
test: Fix ordered publish failure test by forcing scheduled work to be done
1 parent cc41009 commit cd50315

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,6 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception {
511511
* <li>publish with key orderA, which should now succeed
512512
* </ol>
513513
*/
514-
/*
515-
Temporarily disabled due to https://github.com/googleapis/java-pubsub/issues/1861.
516-
TODO(maitrimangal): Enable once resolved.
517514
@Test
518515
public void testResumePublish() throws Exception {
519516
Publisher publisher =
@@ -575,8 +572,8 @@ public void testResumePublish() throws Exception {
575572
testPublisherServiceImpl.addPublishResponse(
576573
PublishResponse.newBuilder().addMessageIds("5").addMessageIds("6"));
577574

578-
Assert.assertEquals("5", future5.get());
579-
Assert.assertEquals("6", future6.get());
575+
assertEquals("5", future5.get());
576+
assertEquals("6", future6.get());
580577

581578
// Resume publishing of "orderA", which should now succeed
582579
publisher.resumePublish("orderA");
@@ -587,8 +584,8 @@ public void testResumePublish() throws Exception {
587584
testPublisherServiceImpl.addPublishResponse(
588585
PublishResponse.newBuilder().addMessageIds("7").addMessageIds("8"));
589586

590-
Assert.assertEquals("7", future7.get());
591-
Assert.assertEquals("8", future8.get());
587+
assertEquals("7", future7.get());
588+
assertEquals("8", future8.get());
592589

593590
shutdownTestPublisher(publisher);
594591
}
@@ -633,6 +630,7 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E
633630
} catch (ExecutionException e) {
634631
assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause());
635632
}
633+
fakeExecutor.advanceTime(Duration.ZERO);
636634

637635
// A subsequent attempt fails immediately.
638636
ApiFuture<String> publishFuture4 = sendTestMessageWithOrderingKey(publisher, "D", "a");
@@ -643,7 +641,6 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E
643641
assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause());
644642
}
645643
}
646-
*/
647644

648645
private ApiFuture<String> sendTestMessageWithOrderingKey(
649646
Publisher publisher, String data, String orderingKey) {

0 commit comments

Comments
 (0)