Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix ordered publish failure test by forcing scheduled work to be done #2025

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,6 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception {
* <li>publish with key orderA, which should now succeed
* </ol>
*/
/*
Temporarily disabled due to https://github.com/googleapis/java-pubsub/issues/1861.
TODO(maitrimangal): Enable once resolved.
@Test
public void testResumePublish() throws Exception {
Publisher publisher =
Expand Down Expand Up @@ -575,8 +572,8 @@ public void testResumePublish() throws Exception {
testPublisherServiceImpl.addPublishResponse(
PublishResponse.newBuilder().addMessageIds("5").addMessageIds("6"));

Assert.assertEquals("5", future5.get());
Assert.assertEquals("6", future6.get());
assertEquals("5", future5.get());
assertEquals("6", future6.get());

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

Assert.assertEquals("7", future7.get());
Assert.assertEquals("8", future8.get());
assertEquals("7", future7.get());
assertEquals("8", future8.get());

shutdownTestPublisher(publisher);
}
Expand Down Expand Up @@ -633,6 +630,7 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E
} catch (ExecutionException e) {
assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause());
}
fakeExecutor.advanceTime(Duration.ZERO);

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

private ApiFuture<String> sendTestMessageWithOrderingKey(
Publisher publisher, String data, String orderingKey) {
Expand Down
Loading