Skip to content

Commit

Permalink
Simplify test
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Jan 19, 2025
1 parent 7ea2051 commit c0340f3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions go/vt/discovery/tablet_picker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ func TestPickPrimary(t *testing.T) {
// there is no primary setup for the shard we correctly return an error.
func TestPickNoPrimary(t *testing.T) {
defer utils.EnsureNoLeaks(t)
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

te := newPickerTestEnv(t, ctx, []string{"cell", "otherCell"})
want := addTablet(ctx, te, 100, topodatapb.TabletType_PRIMARY, "cell", true, true)
defer deleteTablet(t, te, want)
ctx, cancel = context.WithTimeout(ctx, 200*time.Millisecond)
defer cancel()
_, err := te.topoServ.UpdateShardFields(ctx, te.keyspace, te.shard, func(si *topo.ShardInfo) error {
si.PrimaryAlias = nil // force a missing primary
return nil
Expand All @@ -83,9 +81,7 @@ func TestPickNoPrimary(t *testing.T) {
tp, err := NewTabletPicker(ctx, te.topoServ, []string{"otherCell"}, "cell", te.keyspace, te.shard, "primary", TabletPickerOptions{})
require.NoError(t, err)

ctx2, cancel2 := context.WithTimeout(ctx, 200*time.Millisecond)
defer cancel2()
_, err = tp.PickForStreaming(ctx2)
_, err = tp.PickForStreaming(ctx)
require.Errorf(t, err, "No healthy serving tablet")
}

Expand Down

0 comments on commit c0340f3

Please sign in to comment.