Skip to content

Commit 041c2b4

Browse files
committed
add tests for commit without ack
1 parent c40f579 commit 041c2b4

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/topics/test_topic_reader.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@ async def test_read_message(
3131

3232
await reader.close()
3333

34-
async def test_read_and_commit_message(
34+
async def test_read_and_commit_with_close_reader(
35+
self, driver, topic_path, topic_with_messages, topic_consumer
36+
):
37+
async with driver.topic_client.reader(topic_path, topic_consumer) as reader:
38+
message = await reader.receive_message()
39+
reader.commit(message)
40+
41+
async with driver.topic_client.reader(topic_path, topic_consumer) as reader:
42+
message2 = await reader.receive_message()
43+
assert message != message2
44+
45+
async def test_read_and_commit_with_ack(
3546
self, driver, topic_path, topic_with_messages, topic_consumer
3647
):
3748

@@ -103,7 +114,18 @@ def test_read_message(
103114

104115
reader.close()
105116

106-
def test_read_and_commit_message(
117+
def test_read_and_commit_with_close_reader(
118+
self, driver_sync, topic_path, topic_with_messages, topic_consumer
119+
):
120+
with driver_sync.topic_client.reader(topic_path, topic_consumer) as reader:
121+
message = reader.receive_message()
122+
reader.commit(message)
123+
124+
with driver_sync.topic_client.reader(topic_path, topic_consumer) as reader:
125+
message2 = reader.receive_message()
126+
assert message != message2
127+
128+
def test_read_and_commit_with_ack(
107129
self, driver_sync, topic_path, topic_with_messages, topic_consumer
108130
):
109131
reader = driver_sync.topic_client.reader(topic_path, topic_consumer)

0 commit comments

Comments
 (0)