Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion build-support/pulsar-test-service-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd $SRC_DIR

./build-support/pulsar-test-service-stop.sh

CONTAINER_ID=$(docker run -i --user $(id -u) -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:4.0.0 sleep 3600)
CONTAINER_ID=$(docker run -i --user $(id -u) -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:4.2.2 sleep 3600)
echo $CONTAINER_ID > .tests-container-id.txt

docker cp tests/test-conf $CONTAINER_ID:/pulsar/test-conf
Expand Down
2 changes: 1 addition & 1 deletion tests/asyncio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async def test_create_producer_failure(self):
await self._client.create_producer('tenant/ns/asyncio-test-send-failure')
self.fail()
except PulsarException as e:
self.assertEqual(e.error(), pulsar.Result.Timeout)
self.assertEqual(e.error(), pulsar.Result.TopicNotFound)

async def test_send_failure(self):
producer = await self._client.create_producer('asyncio-test-send-failure')
Expand Down
12 changes: 8 additions & 4 deletions tests/pulsar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,11 @@ def test_deliver_at(self):
client = Client(self.serviceUrl)
consumer = client.subscribe("my-python-topic-deliver-at", "my-sub", consumer_type=ConsumerType.Shared)
producer = client.create_producer("my-python-topic-deliver-at")
# Delay message in 1.1s
producer.send(b"hello", deliver_at=int(round(time.time() * 1000)) + 1100)
# Delay must exceed receive(1000) timeout plus broker early-delivery slack.
# Pulsar 4.2.x buckets deliverAt timestamps (trimLowerBit, ~512ms with 1s tick),
# so short delays (e.g. 1100ms) can be delivered immediately on broker >= 4.0.1.
delay_ms = 2500
producer.send(b"hello", deliver_at=int(round(time.time() * 1000)) + delay_ms)

# Message should not be available in the next second
with self.assertRaises(pulsar.Timeout):
Expand All @@ -349,8 +352,9 @@ def test_deliver_after(self):
client = Client(self.serviceUrl)
consumer = client.subscribe("my-python-topic-deliver-after", "my-sub", consumer_type=ConsumerType.Shared)
producer = client.create_producer("my-python-topic-deliver-after")
# Delay message in 1.1s
producer.send(b"hello", deliver_after=timedelta(milliseconds=1100))
# Same margin as test_deliver_at; see comment there for broker 4.2.x bucketing.
delay_ms = 2500
producer.send(b"hello", deliver_after=timedelta(milliseconds=delay_ms))

# Message should not be available in the next second
with self.assertRaises(pulsar.Timeout):
Expand Down
Loading