Skip to content

KAFKA-19421: Deflake streams_broker_down_resilience_test #19999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions tests/kafkatest/tests/streams/base_streams_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def assert_produce_consume(self,

self.assert_consume(client_id, test_state, streams_sink_topic, num_messages, timeout_sec)

def assert_produce(self, topic, test_state, num_messages=5, timeout_sec=60):
producer = self.get_producer(topic, num_messages)
def assert_produce(self, topic, test_state, num_messages=5, timeout_sec=60, repeating_keys=None):
producer = self.get_producer(topic, num_messages, repeating_keys=repeating_keys)
producer.start()

wait_until(lambda: producer.num_acked >= num_messages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ def test_streams_runs_with_broker_down_initially(self, metadata_quorum, group_pr
with processor_2.node.account.monitor_log(processor_2.STDOUT_FILE) as monitor_2:
with processor_3.node.account.monitor_log(processor_3.STDOUT_FILE) as monitor_3:

# repeating_keys enables production of records with keys, ensuring that we produce to all 3 partitions
self.assert_produce(self.inputTopic,
"sending_message_after_broker_down_initially",
num_messages=self.num_messages,
timeout_sec=120)
timeout_sec=120,
repeating_keys=self.num_messages)
Comment on lines +132 to +137
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This comment is repeated verbatim across multiple test cases. Consider abstracting the key-production logic into a helper or adding a shared comment to reduce duplication.

Copilot uses AI. Check for mistakes.


monitor_1.wait_until(self.message,
timeout_sec=120,
Expand Down Expand Up @@ -189,10 +191,12 @@ def test_streams_should_scale_in_while_brokers_down(self, metadata_quorum, group
with processor_2.node.account.monitor_log(processor_2.STDOUT_FILE) as monitor_2:
with processor_3.node.account.monitor_log(processor_3.STDOUT_FILE) as monitor_3:

# repeating_keys enables production of records with keys, ensuring that we produce to all 3 partitions
self.assert_produce(self.inputTopic,
"sending_message_normal_broker_start",
num_messages=self.num_messages,
timeout_sec=120)
timeout_sec=120,
repeating_keys=self.num_messages)

monitor_1.wait_until(self.message,
timeout_sec=120,
Expand Down Expand Up @@ -273,10 +277,12 @@ def test_streams_should_failover_while_brokers_down(self, metadata_quorum, group
with processor_2.node.account.monitor_log(processor_2.STDOUT_FILE) as monitor_2:
with processor_3.node.account.monitor_log(processor_3.STDOUT_FILE) as monitor_3:

# repeating_keys enables production of records with keys, ensuring that we produce to all 3 partitions
self.assert_produce(self.inputTopic,
"sending_message_after_normal_broker_start",
num_messages=self.num_messages,
timeout_sec=120)
timeout_sec=120,
repeating_keys=self.num_messages)

monitor_1.wait_until(self.message,
timeout_sec=120,
Expand Down Expand Up @@ -320,10 +326,12 @@ def test_streams_should_failover_while_brokers_down(self, metadata_quorum, group
with processor_2.node.account.monitor_log(processor_2.STDOUT_FILE) as monitor_2:
with processor_3.node.account.monitor_log(processor_3.STDOUT_FILE) as monitor_3:

# repeating_keys enables production of records with keys, ensuring that we produce to all 3 partitions
self.assert_produce(self.inputTopic,
"sending_message_after_hard_bouncing_streams_instance_bouncing_broker",
num_messages=self.num_messages,
timeout_sec=120)
timeout_sec=120,
repeating_keys=self.num_messages)

monitor_1.wait_until(self.message,
timeout_sec=120,
Expand Down