Repository navigation
cli: fix partitions delete-records with --format json - #3213
Open
LemonCondor wants to merge 1 commit into
Open
LemonCondor wants to merge 1 commit into
LemonCondor wants to merge 1 commit into
Conversation
delete_records() returns a dict keyed by TopicPartition, which json.dumps() rejects. The records were deleted, but the command then printed a traceback and exited 1. Key the CLI output by "topic:partition", as the other partition and group offset commands do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
python -m kafka.admin ... --format json partitions delete-recordsdeletes the records, then prints a traceback and exits 1 (output ofkafka.cli.admin.run_cli()against the testMockBroker):A script that checks the exit code will believe the deletion failed.
delete_records()returns a dict keyed byTopicPartition. The command now keys its output by"topic:partition", aslist-reassignments,alter-reassignmentsand the group offset commands already do. TheKafkaAdminClient.delete_records()return value is unchanged. The defaultrawoutput changes too: its keys are now the same strings instead ofTopicPartition(...).Test: added
TestDeleteRecordsCliintest/admin/test_admin_partitions.py. It fails on master with theTypeErrorabove and passes with the change.pytest test/adminpasses (204 tests, MockBroker only, no real cluster), andpylint --errors-onlyonkafka/cliand the test file reports nothing.