Skip to content

kafka: decouple topic manager tests from Sarama (#5961) - #6528

Closed
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5961-to-release-8.5
Closed

ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5961-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #5961

What problem does this PR solve?

Issue Number: close #5885

Kafka topic manager tests depend on Sarama-specific authorization errors. This couples the behavior tests to the current Kafka client implementation and makes them harder to reuse during the franz-go migration tracked by #5881.

What is changed and how it works?

  • Add the client-independent ErrKafkaAdminAuthorizationFailed error.
  • Translate Sarama topic and cluster authorization errors at the admin adapter boundary.
  • Update topic manager tests to use the AdminClient mock and TiCDC-owned errors instead of Sarama types.
  • Expand Kafka admin adapter tests for config lookup, topic metadata, topic creation, authorization errors, general errors, and cleanup behavior.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test
  • No code

Questions

Will it cause performance regression or break compatibility?

No. The change only normalizes Kafka admin authorization errors at the adapter boundary and preserves the existing topic manager fallback behavior.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

None

Summary by CodeRabbit

  • Bug Fixes

    • Improved Kafka authorization error handling across broker, topic, configuration, and partition operations.
    • Authorization failures are now consistently classified as non-fatal, while other administrative errors retain their context.
    • Improved topic creation and metadata handling, including clearer outcomes for existing topics and delayed visibility.
  • Tests

    • Expanded coverage for Kafka administration, topic creation, authorization failures, and configuration scenarios.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 13, 2026
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 13, 2026
@ti-chi-bot ti-chi-bot added the type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. label Oct 13, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wlwilliamx for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot

Copy link
Copy Markdown
Member Author

@3AceShowHand This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56709512-bd09-4148-890a-442ddd47aa60
📥 Commits

Reviewing files that changed from the base of the PR and between ca7d339 and dc3f0fe.

📒 Files selected for processing (6)
  • downstreamadapter/sink/topicmanager/kafka_topic_manager.go
  • downstreamadapter/sink/topicmanager/kafka_topic_manager_test.go
  • pkg/errors/error.go
  • pkg/errors/error_test.go
  • pkg/sink/kafka/admin.go
  • pkg/sink/kafka/admin_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@3AceShowHand

Copy link
Copy Markdown
Collaborator

Closed by #6405. Consolidating these prerequisite backports into one PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/cherry-pick-not-approved do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants