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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-pubsub'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-pubsub:1.129.4'
implementation 'com.google.cloud:google-cloud-pubsub:1.129.5'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.129.4"
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.129.5"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -411,7 +411,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.129.4
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.129.5
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
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