From 5d5c4931dfc7bb9e0c49da4d03eb836f0cd532e8 Mon Sep 17 00:00:00 2001 From: Noble Mittal Date: Fri, 10 Jan 2025 13:44:45 +0530 Subject: [PATCH] Remove commented code from server_test.go Signed-off-by: Noble Mittal --- go/vt/vtctl/workflow/server_test.go | 251 ---------------------------- 1 file changed, 251 deletions(-) diff --git a/go/vt/vtctl/workflow/server_test.go b/go/vt/vtctl/workflow/server_test.go index aaee75697a8..8bb4a06f23a 100644 --- a/go/vt/vtctl/workflow/server_test.go +++ b/go/vt/vtctl/workflow/server_test.go @@ -189,257 +189,6 @@ func TestCheckReshardingJournalExistsOnTablet(t *testing.T) { } } -// // TestVDiffCreate performs some basic tests of the VDiffCreate function -// // to ensure that it behaves as expected given a specific request. -// func TestVDiffCreate(t *testing.T) { -// ctx := context.Background() -// workflowName := "wf1" -// sourceKeyspace := &testKeyspace{ -// KeyspaceName: "source", -// ShardNames: []string{"0"}, -// } -// targetKeyspace := &testKeyspace{ -// KeyspaceName: "target", -// ShardNames: []string{"-80", "80-"}, -// } -// env := newTestEnv(t, ctx, defaultCellName, sourceKeyspace, targetKeyspace) -// defer env.close() - -// tests := []struct { -// name string -// req *vtctldatapb.VDiffCreateRequest -// wantErr string -// }{ -// { -// name: "no values", -// req: &vtctldatapb.VDiffCreateRequest{}, -// // We did not provide any keyspace or shard. -// wantErr: "FindAllShardsInKeyspace() invalid keyspace name: UnescapeID err: invalid input identifier ''", -// }, -// { -// name: "generated UUID", -// req: &vtctldatapb.VDiffCreateRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// Workflow: workflowName, -// }, -// }, -// } -// for _, tt := range tests { -// t.Run(tt.name, func(t *testing.T) { -// if tt.wantErr == "" { -// env.tmc.expectVRQueryResultOnKeyspaceTablets(targetKeyspace.KeyspaceName, &queryResult{ -// query: "select vrepl_id, table_name, lastpk from _vt.copy_state where vrepl_id in (1) and id in (select max(id) from _vt.copy_state where vrepl_id in (1) group by vrepl_id, table_name)", -// result: &querypb.QueryResult{}, -// }) -// } -// got, err := env.ws.VDiffCreate(ctx, tt.req) -// if tt.wantErr != "" { -// require.EqualError(t, err, tt.wantErr) -// return -// } -// require.NoError(t, err) -// require.NotNil(t, got) -// // Ensure that we always use a valid UUID. -// err = uuid.Validate(got.UUID) -// require.NoError(t, err) -// }) -// } -// } - -// func TestVDiffResume(t *testing.T) { -// ctx := context.Background() -// sourceKeyspace := &testKeyspace{ -// KeyspaceName: "sourceks", -// ShardNames: []string{"0"}, -// } -// targetKeyspace := &testKeyspace{ -// KeyspaceName: "targetks", -// ShardNames: []string{"-80", "80-"}, -// } -// workflow := "testwf" -// uuid := uuid.New().String() -// env := newTestEnv(t, ctx, defaultCellName, sourceKeyspace, targetKeyspace) -// defer env.close() - -// env.tmc.strict = true -// action := string(vdiff.ResumeAction) - -// tests := []struct { -// name string -// req *vtctldatapb.VDiffResumeRequest // vtctld requests -// expectedVDiffRequests map[*topodatapb.Tablet]*vdiffRequestResponse // tablet requests -// wantErr string -// }{ -// { -// name: "basic resume", // Both target shards -// req: &vtctldatapb.VDiffResumeRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Uuid: uuid, -// }, -// expectedVDiffRequests: map[*topodatapb.Tablet]*vdiffRequestResponse{ -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID+tabletUIDStep]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// }, -// }, -// { -// name: "resume on first shard", -// req: &vtctldatapb.VDiffResumeRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// TargetShards: targetKeyspace.ShardNames[:1], -// Workflow: workflow, -// Uuid: uuid, -// }, -// expectedVDiffRequests: map[*topodatapb.Tablet]*vdiffRequestResponse{ -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// }, -// }, -// { -// name: "resume on invalid shard", -// req: &vtctldatapb.VDiffResumeRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// TargetShards: []string{"0"}, -// Workflow: workflow, -// Uuid: uuid, -// }, -// wantErr: fmt.Sprintf("specified target shard 0 not a valid target for workflow %s", workflow), -// }, -// } -// for _, tt := range tests { -// t.Run(tt.name, func(t *testing.T) { -// for tab, vdr := range tt.expectedVDiffRequests { -// env.tmc.expectVDiffRequest(tab, vdr) -// } -// got, err := env.ws.VDiffResume(ctx, tt.req) -// if tt.wantErr != "" { -// require.EqualError(t, err, tt.wantErr) -// } else { -// require.NoError(t, err) -// require.NotNil(t, got) -// } -// env.tmc.confirmVDiffRequests(t) -// }) -// } -// } - -// func TestVDiffStop(t *testing.T) { -// ctx := context.Background() -// sourceKeyspace := &testKeyspace{ -// KeyspaceName: "sourceks", -// ShardNames: []string{"0"}, -// } -// targetKeyspace := &testKeyspace{ -// KeyspaceName: "targetks", -// ShardNames: []string{"-80", "80-"}, -// } -// workflow := "testwf" -// uuid := uuid.New().String() -// env := newTestEnv(t, ctx, defaultCellName, sourceKeyspace, targetKeyspace) -// defer env.close() - -// env.tmc.strict = true -// action := string(vdiff.StopAction) - -// tests := []struct { -// name string -// req *vtctldatapb.VDiffStopRequest // vtctld requests -// expectedVDiffRequests map[*topodatapb.Tablet]*vdiffRequestResponse // tablet requests -// wantErr string -// }{ -// { -// name: "basic stop", // Both target shards -// req: &vtctldatapb.VDiffStopRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Uuid: uuid, -// }, -// expectedVDiffRequests: map[*topodatapb.Tablet]*vdiffRequestResponse{ -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID+tabletUIDStep]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// }, -// }, -// { -// name: "stop on first shard", -// req: &vtctldatapb.VDiffStopRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// TargetShards: targetKeyspace.ShardNames[:1], -// Workflow: workflow, -// Uuid: uuid, -// }, -// expectedVDiffRequests: map[*topodatapb.Tablet]*vdiffRequestResponse{ -// env.tablets[targetKeyspace.KeyspaceName][startingTargetTabletUID]: { -// req: &tabletmanagerdatapb.VDiffRequest{ -// Keyspace: targetKeyspace.KeyspaceName, -// Workflow: workflow, -// Action: action, -// VdiffUuid: uuid, -// }, -// }, -// }, -// }, -// { -// name: "stop on invalid shard", -// req: &vtctldatapb.VDiffStopRequest{ -// TargetKeyspace: targetKeyspace.KeyspaceName, -// TargetShards: []string{"0"}, -// Workflow: workflow, -// Uuid: uuid, -// }, -// wantErr: fmt.Sprintf("specified target shard 0 not a valid target for workflow %s", workflow), -// }, -// } -// for _, tt := range tests { -// t.Run(tt.name, func(t *testing.T) { -// for tab, vdr := range tt.expectedVDiffRequests { -// env.tmc.expectVDiffRequest(tab, vdr) -// } -// got, err := env.ws.VDiffStop(ctx, tt.req) -// if tt.wantErr != "" { -// require.EqualError(t, err, tt.wantErr) -// } else { -// require.NoError(t, err) -// require.NotNil(t, got) -// } -// env.tmc.confirmVDiffRequests(t) -// }) -// } -// } - func TestMoveTablesComplete(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel()