From 685d5cb39b7f974042ae8fce4e0d54f8cbf7edf3 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Fri, 13 Oct 2023 18:49:34 +0200 Subject: [PATCH] v15 compat fixes Signed-off-by: Tim Vaillancourt --- .../planned_reparenter_flaky_test.go | 188 +----------------- 1 file changed, 1 insertion(+), 187 deletions(-) diff --git a/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go b/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go index 097649f4aa6..7a4dd55f52c 100644 --- a/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go +++ b/go/vt/vtctl/reparentutil/planned_reparenter_flaky_test.go @@ -3802,192 +3802,6 @@ func AssertReparentEventsEqual(t *testing.T, expected *events.Reparent, actual * AssertReparentEventsEqualWithMessage(t, expected, actual, "") } -// TestPlannedReparenter_verifyAllTabletsReachable tests the functionality of verifyAllTabletsReachable. -func TestPlannedReparenter_verifyAllTabletsReachable(t *testing.T) { - tests := []struct { - name string - tmc tmclient.TabletManagerClient - tabletMap map[string]*topo.TabletInfo - remoteOpTime time.Duration - wantErr string - }{ - { - name: "Success", - tmc: &testutil.TabletManagerClient{ - PrimaryStatusResults: map[string]struct { - Status *replicationdatapb.PrimaryStatus - Error error - }{ - "zone1-0000000200": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - "zone1-0000000201": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - "zone1-0000000100": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - }, - }, - tabletMap: map[string]*topo.TabletInfo{ - "zone1-0000000100": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 100, - }, - Type: topodatapb.TabletType_PRIMARY, - }, - }, - "zone1-0000000200": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 200, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - "zone1-0000000201": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 201, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - }, - }, { - name: "Failure", - tmc: &testutil.TabletManagerClient{ - PrimaryStatusResults: map[string]struct { - Status *replicationdatapb.PrimaryStatus - Error error - }{ - "zone1-0000000200": { - Error: fmt.Errorf("primary status failed"), - }, - "zone1-0000000201": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - "zone1-0000000100": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - }, - }, - tabletMap: map[string]*topo.TabletInfo{ - "zone1-0000000100": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 100, - }, - Type: topodatapb.TabletType_PRIMARY, - }, - }, - "zone1-0000000200": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 200, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - "zone1-0000000201": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 201, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - }, - wantErr: "primary status failed", - }, { - name: "Timeout", - tmc: &testutil.TabletManagerClient{ - PrimaryStatusDelays: map[string]time.Duration{ - "zone1-0000000100": 20 * time.Second, - }, - PrimaryStatusResults: map[string]struct { - Status *replicationdatapb.PrimaryStatus - Error error - }{ - "zone1-0000000200": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - "zone1-0000000201": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - "zone1-0000000100": { - Status: &replicationdatapb.PrimaryStatus{}, - }, - }, - }, - remoteOpTime: 100 * time.Millisecond, - tabletMap: map[string]*topo.TabletInfo{ - "zone1-0000000100": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 100, - }, - Type: topodatapb.TabletType_PRIMARY, - }, - }, - "zone1-0000000200": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 200, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - "zone1-0000000201": { - Tablet: &topodatapb.Tablet{ - Alias: &topodatapb.TabletAlias{ - Cell: "zone1", - Uid: 201, - }, - Type: topodatapb.TabletType_REPLICA, - }, - }, - }, - wantErr: "context deadline exceeded", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - ts := memorytopo.NewServer(ctx, "zone1") - defer ts.Close() - - pr := &PlannedReparenter{ - ts: ts, - tmc: tt.tmc, - } - if tt.remoteOpTime != 0 { - oldTime := topo.RemoteOperationTimeout - topo.RemoteOperationTimeout = tt.remoteOpTime - defer func() { - topo.RemoteOperationTimeout = oldTime - }() - } - err := pr.verifyAllTabletsReachable(context.Background(), tt.tabletMap) - if tt.wantErr == "" { - require.NoError(t, err) - return - } - require.ErrorContains(t, err, tt.wantErr) - }) - } -} - func TestPlannedReparenterStats(t *testing.T) { prsCounter.ResetAll() reparentShardOpTimings.Reset() @@ -4058,7 +3872,7 @@ func TestPlannedReparenterStats(t *testing.T) { } keyspace := "testkeyspace" shard := "-" - ts := memorytopo.NewServer(context.Background(), "zone1") + ts := memorytopo.NewServer("zone1") ctx := context.Background() logger := logutil.NewMemoryLogger()