Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion go/ioutil/timeout_closer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ func (c *TimeoutCloser) Close() error {

go func() {
defer close(done)
done <- c.closer.Close()
select {
case done <- c.closer.Close():
case <-ctx.Done():
}
}()
select {
case err := <-done:
Expand Down
6 changes: 0 additions & 6 deletions go/vt/srvtopo/resilient_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestGetSrvKeyspace(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts, factory := memorytopo.NewServerAndFactory(ctx, "test_cell")
defer ts.Close()
srvTopoCacheTTL = 200 * time.Millisecond
srvTopoCacheRefresh = 80 * time.Millisecond
defer func() {
Expand Down Expand Up @@ -365,7 +364,6 @@ func TestSrvKeyspaceCachedError(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "test_cell")
defer ts.Close()
srvTopoCacheTTL = 100 * time.Millisecond
srvTopoCacheRefresh = 40 * time.Millisecond
defer func() {
Expand Down Expand Up @@ -437,7 +435,6 @@ func TestWatchSrvVSchema(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "test_cell")
defer ts.Close()
rs := NewResilientServer(ctx, ts, "TestWatchSrvVSchema")

// mu protects watchValue and watchErr.
Expand Down Expand Up @@ -523,7 +520,6 @@ func TestGetSrvKeyspaceNames(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts, factory := memorytopo.NewServerAndFactory(ctx, "test_cell")
defer ts.Close()

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -682,7 +678,6 @@ func TestSrvKeyspaceWatcher(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts, factory := memorytopo.NewServerAndFactory(ctx, "test_cell")
defer ts.Close()
srvTopoCacheTTL = 100 * time.Millisecond
srvTopoCacheRefresh = 40 * time.Millisecond
defer func() {
Expand Down Expand Up @@ -809,7 +804,6 @@ func TestSrvKeyspaceListener(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "test_cell")
defer ts.Close()
srvTopoCacheTTL = 100 * time.Millisecond
srvTopoCacheRefresh = 40 * time.Millisecond
defer func() {
Expand Down
5 changes: 3 additions & 2 deletions go/vt/vtctl/grpcvtctldserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,9 @@ func TestCancelSchemaMigration(t *testing.T) {
test := test
t.Run(test.name, func(t *testing.T) {

ctx := context.Background()
ts := memorytopo.NewServer("zone1")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ts := memorytopo.NewServer(ctx, "zone1")

testutil.AddTablets(ctx, t, ts, &testutil.AddTabletOptions{
AlsoSetShardPrimary: true,
Expand Down