Skip to content

Commit

Permalink
Add unit test case
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Feb 11, 2025
1 parent bca581c commit 59658e4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
3 changes: 0 additions & 3 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1985,9 +1985,6 @@ func (s *Server) dropTargets(ctx context.Context, ts *trafficSwitcher, keepData,
return nil, err
}
}
if err := sw.dropSourceDeniedTables(ctx); err != nil {
return nil, err
}
if err := sw.dropTargetDeniedTables(ctx); err != nil {
return nil, err
}
Expand Down
27 changes: 27 additions & 0 deletions go/vt/vtctl/workflow/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,33 @@ func TestMoveTablesComplete(t *testing.T) {
workflowName, targetKeyspaceName),
},
},
{
name: "ignore source keyspace",
sourceKeyspace: &testKeyspace{
KeyspaceName: sourceKeyspaceName,
ShardNames: []string{"0"},
},
targetKeyspace: &testKeyspace{
KeyspaceName: targetKeyspaceName,
ShardNames: []string{"-80", "80-"},
},
req: &vtctldatapb.MoveTablesCompleteRequest{
TargetKeyspace: targetKeyspaceName,
Workflow: workflowName,
IgnoreSourceKeyspace: true,
},
expectedTargetQueries: []*queryResult{
{
query: fmt.Sprintf("delete from _vt.vreplication where db_name = 'vt_%s' and workflow = '%s'",
targetKeyspaceName, workflowName),
result: &querypb.QueryResult{},
},
},
want: &vtctldatapb.MoveTablesCompleteResponse{
Summary: fmt.Sprintf("Successfully completed the %s workflow in the %s keyspace",
workflowName, targetKeyspaceName),
},
},
{
name: "named lock held",
sourceKeyspace: &testKeyspace{
Expand Down

0 comments on commit 59658e4

Please sign in to comment.