← 输入框|github.com|刷新
Skip to content

[qa] Replicate Kafka test topics so that they survive a broker restart - #7894

Merged
ryzhyk merged 3 commits into
mainfrom
issue-7550
Nov 9, 2026
Merged

ryzhyk merged 3 commits into
mainfrom
issue-7550

Conversation

@ryzhyk

@ryzhyk ryzhyk commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

A test topic had one replica, so whenever the CI cluster restarted the broker that held it, the topic had no leader and the test's producer flush timed out.

Topics now take the broker's default replication factor, 3 on the CI cluster and 1 on a single broker. The tests' producers become idempotent, because the retries that follow a leader change can otherwise write a record twice, and the tests count records.

Linked Issue

Fixes #7550

(the original CI failure was apparently cause by a strimzi bug, but it's nevertheless a good idea to harden tests against broker failures)

Describe Manual Test Plan

Checklist

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

Mark if you think the answer is yes for any of these components:

Describe Incompatible Changes

A test topic had one replica, so whenever the CI cluster restarted the broker
that held it, the topic had no leader and the test's producer flush timed out.

Topics now take the broker's default replication factor, 3 on the CI cluster
and 1 on a single broker. The tests' producers become idempotent, because the
retries that follow a leader change can otherwise write a record twice, and
the tests count records.

Fixes #7550

Signed-off-by: Leonid Ryzhyk <ryzhyk@gmail.com>
@ryzhyk
ryzhyk requested a review from blp November 8, 2026 20:28
@ryzhyk ryzhyk added connectors Issues related to the adapters/connectors crate QA Testing and quality assurance labels Nov 8, 2026
@mythical-fred-oss

Copy link
Copy Markdown
Contributor

What I ran

  • confluent-kafka 2.13.2 (librdkafka 2.13.2, from uv.lock): NewTopic(..., replication_factor=-1) and a Producer with enable.idempotence=True both build fine, and tests.kafka imports cleanly.
  • I could not run the platform/runtime tests, because there is no Kafka broker in this environment.
  • Ruff on the changed files raises no new errors (KAFKA_BOOTSTRAP is still used in every file that lost its Producer import).

missing (medium): one Kafka test still creates topics with a single replica. tests/workloads/test_kafka_avro.py:399 hard-codes "replication_factor": 1, and create_kafka_topic() (line 126) uses its own NewTopic call instead of tests.kafka.create_topic. That test can still lose its partition leader when Strimzi restarts a broker, which is the failure behind #7550. Suggest setting -1 there too, or switching it to the shared helper:

-            "replication_factor": 1,
+            "replication_factor": BROKER_DEFAULT_REPLICATION_FACTOR,

(with from tests.kafka import BROKER_DEFAULT_REPLICATION_FACTOR).

Gates: The PR only changes tests, so there is nothing for docs, breaking changes or dependencies to cover. The commit message is good. The manual test plan is empty, which is acceptable here because a broker restart can't easily be reproduced by hand. Otherwise LGTM.

Variant 1 of TestKafkaAvro still created its topics with one replica, which a
broker restart leaves without a leader (#7550). CI deselects the test for now,
so this matters once it runs again.

Signed-off-by: Leonid Ryzhyk <ryzhyk@gmail.com>
The setup read the variant id where it expected a topic's creation date, so
it deleted every kafka_avro topic on the cluster, including those of runs
still in progress against it, such as the other architecture's job. It now
reads the date that each topic name carries.

Signed-off-by: Leonid Ryzhyk <ryzhyk@gmail.com>
@ryzhyk
ryzhyk enabled auto-merge November 8, 2026 22:45
@ryzhyk
ryzhyk disabled auto-merge November 8, 2026 23:01
@ryzhyk
ryzhyk added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit fa66004 Nov 9, 2026
1 check passed
@ryzhyk
ryzhyk deleted the issue-7550 branch November 9, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connectors Issues related to the adapters/connectors crate QA Testing and quality assurance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime Integration Tests: test_connector_status fails with 'Failed to flush all Kafka messages' after topic partition count drops to 0

2 participants