Skip to content

Commit

Permalink
Test create paused consumer
Browse files Browse the repository at this point in the history
Signed-off-by: Maurice van Veen <[email protected]>
  • Loading branch information
MauriceVanVeen committed Mar 4, 2024
1 parent 52fcc61 commit 10ceba8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/io/nats/client/impl/JetStreamManagementTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,28 @@ public void testAddDeleteConsumer() throws Exception {
});
}

@Test
public void testAddPausedConsumer() throws Exception {
runInJsServer(nc -> {
JetStreamManagement jsm = nc.jetStreamManagement();

createMemoryStream(jsm, STREAM, subjectDot(">"));

List<ConsumerInfo> list = jsm.getConsumers(STREAM);
assertEquals(0, list.size());

ZonedDateTime pauseUntil = ZonedDateTime.now(ZONE_ID_GMT).plusSeconds(30);
ConsumerConfiguration cc = ConsumerConfiguration.builder()
.pauseUntil(pauseUntil)
.build();

// Consumer should be paused on creation.
ConsumerInfo ci = jsm.addOrUpdateConsumer(STREAM, cc);
assertTrue(ci.getPaused());
assertEquals(pauseUntil, ci.getConsumerConfiguration().getPauseUntil());
});
}

@Test
public void testPauseResumeConsumer() throws Exception {
runInJsServer(nc -> {
Expand Down

0 comments on commit 10ceba8

Please sign in to comment.