Add test coverage for dropTargetShards function#19086
Closed
shivansh-gohem wants to merge 2 commits intovitessio:mainfrom
Closed
Add test coverage for dropTargetShards function#19086shivansh-gohem wants to merge 2 commits intovitessio:mainfrom
shivansh-gohem wants to merge 2 commits intovitessio:mainfrom
Conversation
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Adds TestDropTargetShards_NoOp to verify dropTargetShards can be called safely with a configured workflow. Increases coverage from 0% to 75%. Signed-off-by: Shivansh Sahu <sahushivansh142@gmail.com>
262f556 to
b2fd8bf
Compare
Author
Author
|
/cc @timvaillancourt |
mattlord
reviewed
Jan 7, 2026
Comment on lines
+483
to
+484
| err = ts.dropTargetShards(ctx) | ||
| require.NoError(t, err) |
Member
There was a problem hiding this comment.
@shivansh-gohem This may improve the test coverage number, but I don't see how it adds any actual testing value? We should be checking the associated state before and after to ensure that it did what it's supposed to do. Can you please add that?
- Verify target shards exist before calling dropTargetShards() - Verify target shards are cleaned up after function executes - Addresses reviewer feedback about adding actual testing value Signed-off-by: Shivansh Sahu <sahushivansh142@gmail.com>
baa9a69 to
dd982a3
Compare
Contributor
|
This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:
If no action is taken within 7 days, this PR will be closed. |
Contributor
|
This PR was closed because it has been stale for 7 days with no activity. |
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.
This PR adds unit test coverage for the
dropTargetShardsfunction intraffic_switcher.go, which previously had 0% test coverage.Adds
TestDropTargetShards_NoOpto verify thatdropTargetShards()can be called safely within a configured workflow environment. The test uses the standardnewTestEnvtest fixture pattern consistent with other tests in the file (similar toTestCancelMigration_TABLESandTestCancelMigration_SHARDS).Coverage Impact:
dropTargetShardshad 0% test coveragetraffic_switcher.go:1399:dropTargetShardsVerification:
go test ./go/vt/vtctl/workflow -run TestDropTargetShards_NoOp -v
go test ./go/vt/vtctl/workflow -run TestDropTargetShards_NoOp -coverpkg=./go/vt/vtctl/workflow -coverprofile=c.out
go tool cover -func=c.out | grep dropTargetShards
Result: traffic_switcher.go:1399: dropTargetShards 75.0%
Backporting: Not required - this is a test-only change that improves code coverage without any functional modifications.
Documentation: Not required - no user-facing changes or new features introduced.
Related Issue(s)
Fixes #17284
Checklist
Deployment Notes
No deployment impact. This is a test-only change that increases code coverage.