kafka: decouple sarama from tests to make it library independent - #5883
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughKafka administration now uses the ChangesKafka admin abstraction and wiring
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/sink/kafka/oauth2_token_provider_test.go`:
- Around line 90-93: Update the test around newTokenProvider and provider.Token
to assert that the returned Sarama access token has the expected value
"access-token", while retaining the existing no-error assertions and focused
deterministic setup.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 77fa725d-1c04-481d-8a76-cdc909b849df
📒 Files selected for processing (6)
pkg/sink/kafka/oauth2_token_provider_test.gopkg/sink/kafka/options_test.gopkg/sink/kafka/sarama_config_test.gopkg/sink/kafka/sarama_factory.gopkg/sink/kafka/sarama_sync_producer_test.goscripts/generate-mock.sh
💤 Files with no reviewable changes (1)
- pkg/sink/kafka/sarama_config_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- scripts/generate-mock.sh
- pkg/sink/kafka/sarama_factory.go
|
/test all |
|
/test all |
|
/test all |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lidezhu, wk989898 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #5884
Kafka Sink tests are coupled to Sarama implementation details, making them difficult to reuse when introducing another Kafka client.
What is changed and how it works?
This PR makes Kafka Sink tests library-independent by testing TiCDC-owned behavior instead of Sarama internals. It covers Kafka Sink verification, topic management, configuration, OAuth2, and producer error handling through common interfaces and test doubles, providing a reusable behavior baseline for future Kafka client implementations.
The production Kafka client and runtime behavior remain unchanged.
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
No.
Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit
Bug Fixes
Refactor