-
Notifications
You must be signed in to change notification settings - Fork 317
test: improve test coverage for pkg/datasource/sql/undo #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive unit test coverage for the undo logging functionality in the SQL datasource package. The tests validate manager registration, builder patterns, executor interfaces, and configuration handling for the undo log system.
- Unit tests added for core undo functionality including manager, builder, and executor interfaces
- Configuration and compression handling test coverage
- MySQL-specific undo log manager implementation tests
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/datasource/sql/undo/undo_test.go | Tests for undo log manager registration, builder patterns, and core data structures |
| pkg/datasource/sql/undo/undo_executor_test.go | Tests for undo executor interface implementation |
| pkg/datasource/sql/undo/undo_executor_holder_test.go | Tests for undo executor holder interface and factory methods |
| pkg/datasource/sql/undo/mysql/undo_test.go | Tests for MySQL-specific undo log manager implementation |
| pkg/datasource/sql/undo/mysql/default_test.go | Tests for MySQL undo log manager initialization |
| pkg/datasource/sql/undo/factor/undo_executor_holder_factor_test.go | Tests for undo executor holder factory with lazy initialization |
| pkg/datasource/sql/undo/factor/undo_executor_factory_test.go | Tests for undo executor factory and SQL type routing |
| pkg/datasource/sql/undo/config_test.go | Tests for undo configuration and flag registration |
| pkg/datasource/sql/undo/base/undo_test.go | Tests for base undo log manager utility functions |
| go.mod | Updated to include testify mock dependency |
| go.sum | Checksum for testify objx dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/datasource/sql/undo/undo_test.go
Outdated
| }{ | ||
| { | ||
| name: "can undo - normal status", | ||
| logStatus: UndoLogStatueNormnal, |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'UndoLogStatueNormnal' to 'UndoLogStatusNormal'. The constant name contains typo 'Statue' instead of 'Status' and 'Normnal' instead of 'Normal'.
| logStatus: UndoLogStatueNormnal, | |
| logStatus: UndoLogStatusNormal, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was a spelling error in the original constant name; it has now been corrected.
pkg/datasource/sql/undo/undo_test.go
Outdated
| logStatus UndoLogStatue | ||
| want bool | ||
| }{ | ||
| { | ||
| name: "can undo - normal status", | ||
| logStatus: UndoLogStatueNormnal, | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "cannot undo - global finished", | ||
| logStatus: UndoLogStatueGlobalFinished, |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'UndoLogStatue' to 'UndoLogStatus'. The type name contains typo 'Statue' instead of 'Status'.
| logStatus UndoLogStatue | |
| want bool | |
| }{ | |
| { | |
| name: "can undo - normal status", | |
| logStatus: UndoLogStatueNormnal, | |
| want: true, | |
| }, | |
| { | |
| name: "cannot undo - global finished", | |
| logStatus: UndoLogStatueGlobalFinished, | |
| logStatus UndoLogStatus | |
| want bool | |
| }{ | |
| { | |
| name: "can undo - normal status", | |
| logStatus: UndoLogStatusNormal, | |
| want: true, | |
| }, | |
| { | |
| name: "cannot undo - global finished", | |
| logStatus: UndoLogStatusGlobalFinished, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was a spelling error in the original constant name; it has now been corrected.
pkg/datasource/sql/undo/undo_test.go
Outdated
| }, | ||
| { | ||
| name: "cannot undo - global finished", | ||
| logStatus: UndoLogStatueGlobalFinished, |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'UndoLogStatueGlobalFinished' to 'UndoLogStatusGlobalFinished'. The constant name contains typo 'Statue' instead of 'Status'.
| logStatus: UndoLogStatueGlobalFinished, | |
| logStatus: UndoLogStatusGlobalFinished, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was a spelling error in the original constant name; it has now been corrected.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #971 +/- ##
==========================================
- Coverage 46.33% 45.90% -0.43%
==========================================
Files 195 200 +5
Lines 11887 12264 +377
==========================================
+ Hits 5508 5630 +122
- Misses 5943 6196 +253
- Partials 436 438 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move manager variable creation after t.Skip() calls in MySQL undo tests to prevent unused variable warnings from golangci-lint staticcheck. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
@LucienShen-Liu pls resolve conflicts |
done |
What this PR does:improve test coverage for pkg/datasource/sql/undo
Which issue(s) this PR fixes: #940
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: