Skip to content

Commit

Permalink
Remove test util func AssertSameTablets since results are always sort…
Browse files Browse the repository at this point in the history
…ed for getTablets now

Signed-off-by: Lucas Morduchowicz <lmorduch@gmail.com>
  • Loading branch information
lmorduch committed Feb 12, 2025
1 parent fd13c20 commit 783eb3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions go/vt/vtctl/grpcvtctldserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4605,7 +4605,7 @@ func TestDeleteTablets(t *testing.T) {

resp, err := vtctld.GetTablets(ctx, &vtctldatapb.GetTabletsRequest{})
assert.NoError(t, err, "cannot look up tablets from topo after issuing DeleteTablets request")
testutil.AssertSameTablets(t, tt.expectedRemainingTablets, resp.Tablets)
utils.MustMatch(t, tt.expectedRemainingTablets, resp.Tablets)
}

// Run the test
Expand Down Expand Up @@ -13338,7 +13338,7 @@ func TestTabletExternallyReparented(t *testing.T) {

resp, err := vtctld.GetTablets(ctx, &vtctldatapb.GetTabletsRequest{})
require.NoError(t, err, "cannot get all tablets in the topo")
testutil.AssertSameTablets(t, tt.expectedTopo, resp.Tablets)
utils.MustMatch(t, tt.expectedTopo, resp.Tablets)
}()
}

Expand Down
13 changes: 0 additions & 13 deletions go/vt/vtctl/grpcvtctldserver/testutil/proto_compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ package testutil

import (
"encoding/json"
"fmt"
"sort"
"testing"

"github.com/stretchr/testify/assert"

"vitess.io/vitess/go/test/utils"
logutilpb "vitess.io/vitess/go/vt/proto/logutil"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
)

Expand Down Expand Up @@ -108,16 +105,6 @@ func AssertPlannedReparentShardResponsesEqual(t *testing.T, expected *vtctldatap
utils.MustMatch(t, expected, actual)
}

func AssertSameTablets(t *testing.T, expected, actual []*topodatapb.Tablet) {
sort.Slice(expected, func(i, j int) bool {
return fmt.Sprintf("%v", expected[i]) < fmt.Sprintf("%v", expected[j])
})
sort.Slice(actual, func(i, j int) bool {
return fmt.Sprintf("%v", actual[i]) < fmt.Sprintf("%v", actual[j])
})
utils.MustMatch(t, expected, actual)
}

// AssertKeyspacesEqual is a convenience function to assert that two
// vtctldatapb.Keyspace objects are equal, after clearing out any reserved
// proto XXX_ fields.
Expand Down

0 comments on commit 783eb3a

Please sign in to comment.