Skip to content

Commit bfe5597

Browse files
committed
test: re-enable and fix timed-out unit tests in PublisherImplTest
Fixes #13051
1 parent dc965fe commit bfe5597

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,7 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception {
512512
* <li>publish with key orderA, which should now succeed
513513
* </ol>
514514
*/
515-
/*
516-
Temporarily disabled due to https://github.com/googleapis/java-pubsub/issues/1861.
517-
TODO(maitrimangal): Enable once resolved.
515+
518516
@Test
519517
public void testResumePublish() throws Exception {
520518
Publisher publisher =
@@ -527,6 +525,8 @@ public void testResumePublish() throws Exception {
527525
.setEnableMessageOrdering(true)
528526
.build();
529527

528+
testPublisherServiceImpl.setExecutor(fakeExecutor);
529+
530530
ApiFuture<String> future1 = sendTestMessageWithOrderingKey(publisher, "m1", "orderA");
531531
ApiFuture<String> future2 = sendTestMessageWithOrderingKey(publisher, "m2", "orderA");
532532

@@ -536,7 +536,6 @@ public void testResumePublish() throws Exception {
536536

537537
// This exception should stop future publishing to the same key
538538
testPublisherServiceImpl.addPublishError(new StatusException(Status.INVALID_ARGUMENT));
539-
540539
fakeExecutor.advanceTime(Duration.ZERO);
541540

542541
try {
@@ -576,8 +575,8 @@ public void testResumePublish() throws Exception {
576575
testPublisherServiceImpl.addPublishResponse(
577576
PublishResponse.newBuilder().addMessageIds("5").addMessageIds("6"));
578577

579-
Assert.assertEquals("5", future5.get());
580-
Assert.assertEquals("6", future6.get());
578+
assertEquals("5", future5.get());
579+
assertEquals("6", future6.get());
581580

582581
// Resume publishing of "orderA", which should now succeed
583582
publisher.resumePublish("orderA");
@@ -588,8 +587,8 @@ public void testResumePublish() throws Exception {
588587
testPublisherServiceImpl.addPublishResponse(
589588
PublishResponse.newBuilder().addMessageIds("7").addMessageIds("8"));
590589

591-
Assert.assertEquals("7", future7.get());
592-
Assert.assertEquals("8", future8.get());
590+
assertEquals("7", future7.get());
591+
assertEquals("8", future8.get());
593592

594593
shutdownTestPublisher(publisher);
595594
}
@@ -598,7 +597,6 @@ public void testResumePublish() throws Exception {
598597
public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws Exception {
599598
Publisher publisher =
600599
getTestPublisherBuilder()
601-
.setExecutorProvider(SINGLE_THREAD_EXECUTOR)
602600
.setBatchingSettings(
603601
Publisher.Builder.DEFAULT_BATCHING_SETTINGS
604602
.toBuilder()
@@ -644,7 +642,6 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E
644642
assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause());
645643
}
646644
}
647-
*/
648645

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

0 commit comments

Comments
 (0)