Repository navigation
test: add Kafka CLI smoke tests for retention, compaction, kafka-delete-records and SCRAM - #923
Conversation
solace-aross
left a comment
There was a problem hiding this comment.
Approving at 047b99b with two notes.
I read the harness and the new tests. What I checked:
- Every ignored test names an open issue or PR (#864, #904, #918 to #922, and #835 for DeleteRecords), and the five filed issues match the behavior each test describes.
- The retention tests are built to avoid flaking. They produce hour-old records, run maintenance every 2 seconds, wait up to 60 seconds, and keep a newer record in the topic so the earliest offset never reads as the 0 of an emptied partition.
wait_for_maintenance_runcovers the tests that expect records to survive. - The SCRAM login tests create the user before restarting with
--authentication. They check that the credentials survive the restart, so moving the three restart tests out ofrestart.rsloses no coverage. - The
file_existsfix is right. The broker image has notest, so the olddocker execversion returned false for every file.docker cpwith an explicit working directory fixes it, and a failure other than a missing file panics instead of reading as missing. - The snapshot test waits for two snapshot writes and deletes the live database and its
-waland-shmfiles, so the records can only come from the snapshot.
Notes:
- No CI has run on this head except DCO, because the base is the #902 branch. The results in the description are local runs. Rerun the checks once it is retargeted to main, and watch the s3 leg and the Kafka 3.7 and 4.3 tools, which the description lists as untested locally.
- Merge order is #862, then #902, then this PR.
047b99b to
d68eaa3
Compare
solace-aross
left a comment
There was a problem hiding this comment.
Approving at d68eaa3. The PR's own commits are unchanged. The only difference from my last review is the base moving to #902's current head, which brings in random_password() for the SCRAM test passwords (the CodeQL fix I approved on #902).
CI is green on this head, including test (postgres:17), both compat legs and ci-gate. The base is still #902's branch, so the smoke legs are skipped; rerun the checks once this is retargeted to main, and watch the s3 leg and the Kafka 3.7 and 4.3 tools. Merge order is #862, then #902, then #923.
…duce old records and restart on other storage Adds kafka-delete-records and kafka-configs --describe --entity-type users to the harness, a verifiable producer that sets the records' timestamps, a broker that runs maintenance every 2 seconds, and a restart onto other storage that can delete files first. Reading a file where a broker runs now copies it out with docker cp, because the broker image has no test or stat command, so file_exists used to return false for every file in a broker container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: William Kourlas <156007774+solace-wkourlas@users.noreply.github.com>
…SQLite Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: William Kourlas <156007774+solace-wkourlas@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: William Kourlas <156007774+solace-wkourlas@users.noreply.github.com>
… into them Every SCRAM login test restarts the broker, because a broker with --authentication can't create its first user, so the restart tests' SCRAM checks were duplicates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: William Kourlas <156007774+solace-wkourlas@users.noreply.github.com>
…napshot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: William Kourlas <156007774+solace-wkourlas@users.noreply.github.com>
d68eaa3 to
0193898
Compare
solace-aross
left a comment
There was a problem hiding this comment.
Approving at 0193898. The branch is retargeted to main now that #862, #863 and #902 have merged. The PR's own smoke-test changes are identical to what I approved at d68eaa3, and its diff against main is the same 15 files under nisshi-smoke-test.
Two things to watch:
- CI was still running when I approved: Analyze, clippy, both compat legs and third-party-license. fmt, typos, zizmor, actionlint, cargo-deny and DCO pass.
- The smoke legs don't run on PR pushes, so the s3 leg and the Kafka 3.7 and 4.3 tools get their first run in the merge queue. Worth a look at those results before treating this as done.
Stacked on #902: review that one first.
What changes, and why?
It adds smoke tests that run the Kafka CLI tools against Nisshi for the broker's maintenance and authentication:
cleanup.policy,retention.ms=-1, a 30-dayretention.ms,kafka-configs --add-configand--delete-config retention.ms,retention.bytes, offsets after retention empties a partition.compact,delete.kafka-delete-records(every engine): the new low watermark, the earliest offset, the latest offset.kafka-configsand described with it; login with SCRAM-SHA-256 and SCRAM-SHA-512, a wrong password, and a client without credentials, all on PostgreSQL and SQLite, because a broker with--authenticationcan't create its first user, so each test restarts the broker. That restart duplicated three SCRAM tests inrestart.rs, which this PR moves intoscram.rs.vacuum_into: a broker started on the snapshot, after its own database has been deleted, has the topics and records.Harness changes:
kafka-delete-records,kafka-configs --describe --entity-type users, a producer that sets old timestamps, a broker that runs maintenance every 2 seconds, and a restart onto other storage that can delete files first.Broker::file_existsnow copies the file out withdocker cp. It useddocker exec … test, and the broker image has notestcommand, so it returnedfalsefor every file in a broker container.Ignored tests
Each is waiting for:
cleanup.policyis never cleanedretention.ms=-1deletes every recordretention.msabove 2147483647 stops retention on PostgreSQL (2 tests)retention.bytesis ignoredkafka-configscan't describe users withoutDescribeClientQuotaskafka-configs --delete-configrefuses a topic's own configdelete_recordstestsUpgrade impact
None. This changes only the smoke tests.
How was this tested?
Local runs of
just smoke <engine>with every test, the ignored ones included, and the Kafka 3.9 tools:On each engine, the failed tests are exactly the tests ignored on that engine, so CI, which skips them, passes. The failures include the ignored tests from #902.
cargo clippy -p nisshi-smoke-test --all-features --all-targets -- -D warnings, and with--features memorycargo fmt --check, and rustdoc with warnings denied🤖 Generated with Claude Code