Skip to content

Commit

Permalink
vttablet: fix test flakyness
Browse files Browse the repository at this point in the history
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
  • Loading branch information
sougou committed Aug 1, 2020
1 parent d86fb18 commit 0fdae88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/vt/vttablet/tabletserver/state_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"vitess.io/vitess/go/sync2"
"vitess.io/vitess/go/vt/log"
querypb "vitess.io/vitess/go/vt/proto/query"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/vttablet/tabletserver/tabletenv"
Expand Down Expand Up @@ -248,8 +249,9 @@ func (te *testWatcher) Close() {
}

func TestStateManagerSetServingTypeRace(t *testing.T) {
// We don't call StopService because that in turn
// will call Close again on testWatcher.
sm := newTestStateManager(t)
defer sm.StopService()
te := &testWatcher{
t: t,
sm: sm,
Expand All @@ -267,6 +269,7 @@ func TestStateManagerSetServingTypeRace(t *testing.T) {
}

func TestStateManagerSetServingTypeNoChange(t *testing.T) {
log.Infof("starting")
sm := newTestStateManager(t)
defer sm.StopService()
err := sm.SetServingType(topodatapb.TabletType_REPLICA, testNow, StateServing, "")
Expand Down Expand Up @@ -591,6 +594,7 @@ func newTestStateManager(t *testing.T) *stateManager {
}
sm.Init(env, querypb.Target{})
sm.hs.InitDBConfig(querypb.Target{})
log.Infof("returning sm: %p", sm)
return sm
}

Expand Down

0 comments on commit 0fdae88

Please sign in to comment.