Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Bump pulsar version to 2.8.1.0 (#953)
Browse files Browse the repository at this point in the history
Fix #950

### Motivation

apache/pulsar#13066 introduced a breaking change to the `MockZooKeeper` API and causes test failure. 

### Modifications

* Fix failure test
* Upgrade pulsar version to 2.8.1.0
  • Loading branch information
Demogorgon314 authored Dec 6, 2021
1 parent 68efeef commit a2e9b4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<lombok.version>1.18.4</lombok.version>
<mockito.version>2.22.0</mockito.version>
<pulsar.group.id>io.streamnative</pulsar.group.id>
<pulsar.version>2.8.0.15</pulsar.version>
<pulsar.version>2.8.1.0</pulsar.version>
<slf4j.version>1.7.25</slf4j.version>
<spotbugs-annotations.version>3.1.8</spotbugs-annotations.version>
<testng.version>6.14.3</testng.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import static org.testng.AssertJUnit.fail;

import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
Expand All @@ -31,6 +33,8 @@
@Slf4j
public class ProducerIdManagerTest extends KopProtocolHandlerTestBase {

private static final long DEFAULT_TEST_TIMEOUT = 20 * 1000;

@BeforeClass
@Override
protected void setup() throws Exception {
Expand All @@ -51,7 +55,7 @@ protected void cleanZNode() throws Exception {
}
}

@Test
@Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testGetProducerId() throws Exception {
ProducerIdManager manager1 = new ProducerIdManager(0, pulsar.getLocalMetadataStore());
manager1.initialize().get();
Expand All @@ -76,13 +80,14 @@ public void testGetProducerId() throws Exception {
assertEquals(pid2 + ProducerIdManager.PID_BLOCK_SIZE * 2, manager2.generateProducerId().get().longValue());
}

@Test
@Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testExceedProducerIdLimit() throws Exception {
mockZooKeeper.create(ProducerIdManager.KOP_PID_BLOCK_ZNODE, null, null, null);
mockZooKeeper.setData(ProducerIdManager.KOP_PID_BLOCK_ZNODE,
ProducerIdManager.generateProducerIdBlockJson(
new ProducerIdManager.ProducerIdBlock(
1, Long.MAX_VALUE - ProducerIdManager.PID_BLOCK_SIZE, Long.MAX_VALUE)), -1);
pulsar.getLocalMetadataStore()
.put(ProducerIdManager.KOP_PID_BLOCK_ZNODE,
ProducerIdManager.generateProducerIdBlockJson(
new ProducerIdManager.ProducerIdBlock(
1, Long.MAX_VALUE - ProducerIdManager.PID_BLOCK_SIZE, Long.MAX_VALUE)),
Optional.empty()).get(10, TimeUnit.SECONDS);

ProducerIdManager producerIdManager = new ProducerIdManager(0, pulsar.getLocalMetadataStore());
try {
Expand Down

0 comments on commit a2e9b4c

Please sign in to comment.