Skip to content

Remove pingcap/check#4300

Open
dveeden wants to merge 2 commits intopingcap:masterfrom
dveeden:pingcap/check
Open

Remove pingcap/check#4300
dveeden wants to merge 2 commits intopingcap:masterfrom
dveeden:pingcap/check

Conversation

@dveeden
Copy link
Contributor

@dveeden dveeden commented Feb 27, 2026

What problem does this PR solve?

Issue Number: close #4301

This removes pingcap/check as direct dependency. Most of this repo already is using testify.

What is changed and how it works?

Check List

Tests

  • Unit test

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

None

Summary by CodeRabbit

  • Tests

    • Migrated test infrastructure from gocheck to Go's standard testing framework with testify assertions for improved maintainability and consistency.
  • Chores

    • Updated dependency management by transitioning pingcap/check to an indirect dependency.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 27, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the project's testing infrastructure by eliminating an external testing framework. By migrating existing tests to use standard Go testing practices with a popular assertion library, the change reduces the project's dependency footprint and aligns with common Go development patterns, potentially simplifying future maintenance and onboarding for new contributors.

Highlights

  • Dependency Removal: The github.com/pingcap/check testing framework dependency has been removed from the project's direct requirements.
  • Test Migration: All affected unit tests within the pkg/diff package have been migrated from github.com/pingcap/check to use Go's standard testing package in conjunction with github.com/stretchr/testify/require for assertions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • go.mod
    • Removed github.com/pingcap/check from direct dependencies and updated its status to an indirect dependency.
  • pkg/diff/chunk_test.go
    • Migrated test suite from github.com/pingcap/check to testing and github.com/stretchr/testify/require.
  • pkg/diff/diff_test.go
    • Updated test functions and assertions from github.com/pingcap/check to testing and github.com/stretchr/testify/require.
  • pkg/diff/merge_test.go
    • Converted test suite from github.com/pingcap/check to standard testing with github.com/stretchr/testify/require.
  • pkg/diff/spliter_test.go
    • Refactored test functions and assertions from github.com/pingcap/check to testing and github.com/stretchr/testify/require.
Activity
  • The pull request description is empty, indicating no specific human activity or comments have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

This PR migrates test files from the gocheck framework (pingcap/check) to Go's standard testing package with testify/require assertions and updates go.mod to make pingcap/check an indirect dependency. No exported APIs were changed.

Changes

Cohort / File(s) Summary
Dependency Migration
go.mod
Removed direct require of github.com/pingcap/check, added it as an indirect dependency; other go.mod entries unchanged.
Test Framework Migration
pkg/diff/chunk_test.go, pkg/diff/diff_test.go, pkg/diff/merge_test.go, pkg/diff/spliter_test.go
Replaced gocheck suite-based tests with top-level testing functions; removed suite types and check.Suite registrations; switched assertions from c.Assert to require.* and adjusted imports. Test logic preserved.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

lgtm

Suggested reviewers

  • wk989898

Poem

🐰 Hop, hop, the tests take flight anew,
Gone the suites, hello testing view,
With require I nibble bugs in sight,
Clean and simple—what a delight! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Remove pingcap/check' directly and accurately summarizes the main change: removing the pingcap/check dependency from the project.
Description check ✅ Passed PR description is mostly complete with issue reference, change summary, and test information, though some template sections lack detail.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@dveeden
Copy link
Contributor Author

dveeden commented Feb 27, 2026

/cc @wk989898 @dumanshu

@ti-chi-bot ti-chi-bot bot requested a review from wk989898 February 27, 2026 12:15
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 27, 2026

@dveeden: GitHub didn't allow me to request PR reviews from the following users: dumanshu.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

/cc @wk989898 @dumanshu

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.

@dveeden
Copy link
Contributor Author

dveeden commented Feb 27, 2026

/cc @wlwilliamx

@ti-chi-bot ti-chi-bot bot requested a review from wlwilliamx February 27, 2026 12:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/diff/diff_test.go (1)

75-92: Minor: Consider consistent argument order for require.Equal.

On line 86, require.Equal(t, hash2, hash1) has arguments in a different order compared to line 91's require.NotEqual(t, hash1, hash3). For consistency and clearer error messages on failure, consider using require.Equal(t, hash1, hash2) since hash1 is the expected reference value being compared against.

This is a stylistic suggestion and doesn't affect test correctness.

Suggested fix
-	require.Equal(t, hash2, hash1)
+	require.Equal(t, hash1, hash2)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/diff/diff_test.go` around lines 75 - 92, In TestConfigHash, make the
require.Equal assertion use the consistent expected-actual ordering by changing
require.Equal(t, hash2, hash1) to require.Equal(t, hash1, hash2) so the expected
reference value (hash1) is the first argument; locate this in the TestConfigHash
function near the require calls comparing hash1, hash2, and hash3.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/diff/diff_test.go`:
- Around line 75-92: In TestConfigHash, make the require.Equal assertion use the
consistent expected-actual ordering by changing require.Equal(t, hash2, hash1)
to require.Equal(t, hash1, hash2) so the expected reference value (hash1) is the
first argument; locate this in the TestConfigHash function near the require
calls comparing hash1, hash2, and hash3.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8e6236 and f75e19c.

📒 Files selected for processing (5)
  • go.mod
  • pkg/diff/chunk_test.go
  • pkg/diff/diff_test.go
  • pkg/diff/merge_test.go
  • pkg/diff/spliter_test.go

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to remove the pingcap/check dependency and replace its usage with stretchr/testify. The changes are generally well-executed. However, pingcap/check still remains as an indirect dependency in go.mod, which contradicts the main goal of this PR. Additionally, there are some minor opportunities for code simplification in the test files to make the assertions more idiomatic with testify. I've added specific comments with suggestions.

github.com/philhofer/fwd v1.2.0 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pingcap/badger v1.5.1-0.20241015064302-38533b6cbf8d // indirect
github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0 // indirect

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The goal of this PR is to remove the pingcap/check dependency. However, it's still present as an indirect dependency. This might be because another dependency requires it, or go mod tidy hasn't been run after removing the direct usages.

Please run go mod tidy to ensure the dependency is fully removed. If it persists, use go mod why github.com/pingcap/check to identify which module is still using it and address that as well to fully complete the removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ go mod why github.com/pingcap/check
# github.com/pingcap/check
github.com/pingcap/ticdc/cmd/cdc/server
github.com/pingcap/tiflow/pkg/cmd/server
github.com/pingcap/tiflow/cdc/server
github.com/pingcap/tiflow/cdc/processor
github.com/pingcap/tiflow/pkg/sink/mysql
github.com/pingcap/tiflow/dm/pkg/conn
github.com/pingcap/check

Other dependencies still use this

@dveeden
Copy link
Contributor Author

dveeden commented Feb 27, 2026

/check-issue-triage-complete

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 28, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 28, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wk989898

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

The pull request process is described 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

ti-chi-bot bot commented Feb 28, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-28 06:04:50.389837736 +0000 UTC m=+76114.309003862: ☑️ agreed by wk989898.

@ti-chi-bot ti-chi-bot bot added the approved label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TiCDC uses both pingcap/check and testify

2 participants