Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -512,21 +512,19 @@ 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 =
getTestPublisherBuilder()
.setBatchingSettings(
Publisher.Builder.DEFAULT_BATCHING_SETTINGS
.toBuilder()
Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder()
.setElementCountThreshold(2L)
.build())
.setEnableMessageOrdering(true)
.build();

testPublisherServiceImpl.setExecutor(fakeExecutor);

ApiFuture<String> future1 = sendTestMessageWithOrderingKey(publisher, "m1", "orderA");
ApiFuture<String> future2 = sendTestMessageWithOrderingKey(publisher, "m2", "orderA");

Expand All @@ -536,7 +534,6 @@ public void testResumePublish() throws Exception {

// This exception should stop future publishing to the same key
testPublisherServiceImpl.addPublishError(new StatusException(Status.INVALID_ARGUMENT));

fakeExecutor.advanceTime(Duration.ZERO);

try {
Expand Down Expand Up @@ -576,8 +573,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 @@ -588,8 +585,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 All @@ -598,10 +595,8 @@ public void testResumePublish() throws Exception {
public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws Exception {
Publisher publisher =
getTestPublisherBuilder()
Comment on lines 596 to 597
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test testResumePublish was updated to include testPublisherServiceImpl.setExecutor(fakeExecutor); to resolve timeout issues. It appears that testPublishThrowExceptionForUnsubmittedOrderingKeyMessage might require a similar configuration to ensure the mock service uses the same fake executor, especially since it is also being re-enabled after previously timing out.

    testPublisherServiceImpl.setExecutor(fakeExecutor);
    Publisher publisher =
        getTestPublisherBuilder()

.setExecutorProvider(SINGLE_THREAD_EXECUTOR)
.setBatchingSettings(
Publisher.Builder.DEFAULT_BATCHING_SETTINGS
.toBuilder()
Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder()
.setElementCountThreshold(2L)
.setDelayThresholdDuration(Duration.ofSeconds(500))
.build())
Expand Down Expand Up @@ -644,7 +639,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