Skip to content

Commit 0fc51a0

Browse files
grishafcursoragent
andauthored
test: bump CI broker to 4.2.2 and fix delayed-delivery tests (#308)
Upgrade the integration-test Pulsar image from 4.0.0 to 4.2.2. Increase deliver_at/deliver_after delay to 2500ms because broker 4.0.1+ buckets deliverAt timestamps (~512ms with the default 1s tick), so the old 1100ms margin no longer guarantees receive(1000) times out. Expect TopicNotFound when creating a producer on a non-existent tenant/ns on broker 4.2.x. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 836d856 commit 0fc51a0

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cd $SRC_DIR
2525

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

28-
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)
28+
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)
2929
echo $CONTAINER_ID > .tests-container-id.txt
3030

3131
docker cp tests/test-conf $CONTAINER_ID:/pulsar/test-conf

tests/asyncio_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ async def test_create_producer_failure(self):
201201
await self._client.create_producer('tenant/ns/asyncio-test-send-failure')
202202
self.fail()
203203
except PulsarException as e:
204-
self.assertEqual(e.error(), pulsar.Result.Timeout)
204+
self.assertEqual(e.error(), pulsar.Result.TopicNotFound)
205205

206206
async def test_send_failure(self):
207207
producer = await self._client.create_producer('asyncio-test-send-failure')

tests/pulsar_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,11 @@ def test_deliver_at(self):
330330
client = Client(self.serviceUrl)
331331
consumer = client.subscribe("my-python-topic-deliver-at", "my-sub", consumer_type=ConsumerType.Shared)
332332
producer = client.create_producer("my-python-topic-deliver-at")
333-
# Delay message in 1.1s
334-
producer.send(b"hello", deliver_at=int(round(time.time() * 1000)) + 1100)
333+
# Delay must exceed receive(1000) timeout plus broker early-delivery slack.
334+
# Pulsar 4.2.x buckets deliverAt timestamps (trimLowerBit, ~512ms with 1s tick),
335+
# so short delays (e.g. 1100ms) can be delivered immediately on broker >= 4.0.1.
336+
delay_ms = 2500
337+
producer.send(b"hello", deliver_at=int(round(time.time() * 1000)) + delay_ms)
335338

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

355359
# Message should not be available in the next second
356360
with self.assertRaises(pulsar.Timeout):

0 commit comments

Comments
 (0)