Skip to content

Commit

Permalink
Merge #60618
Browse files Browse the repository at this point in the history
60618: *: fix uses of leaktest.AfterTest r=knz a=ajwerner

These places did not invoke the returned closure. Probably something to be done in the linter still. 

Release note: None

Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
  • Loading branch information
craig[bot] and ajwerner committed Feb 17, 2021
2 parents 516494a + 1066a4b commit fdfcf23
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions pkg/kv/kvserver/closedts/tracker/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import (
)

func TestLockfreeTracker(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
ctx := context.Background()
tr := NewLockfreeTracker()
testTracker(ctx, t, tr)
}

func TestHeapTracker(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
ctx := context.Background()
tr := newHeapTracker()
testTracker(ctx, t, tr)
Expand Down Expand Up @@ -99,7 +99,7 @@ func testTracker(ctx context.Context, t *testing.T, tr Tracker) {
// much lower than the lowest timestamp at which a request is currently
// evaluating).
func TestLockfreeTrackerRandomStress(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
ctx := context.Background()
tr := NewLockfreeTracker().(*lockfreeTracker)

Expand Down
2 changes: 1 addition & 1 deletion pkg/migration/migrationcluster/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestCluster_IterateRangeDescriptors(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()

ctx := context.Background()
const numNodes = 1
Expand Down
4 changes: 2 additions & 2 deletions pkg/migration/migrationcluster/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (n NoopDialer) Dial(
var _ NodeDialer = NoopDialer{}

func TestHelperEveryNode(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()

ctx := context.Background()
var mu syncutil.Mutex
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestHelperEveryNode(t *testing.T) {
}

func TestClusterNodes(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()

ctx := context.Background()
const numNodes = 3
Expand Down
4 changes: 2 additions & 2 deletions pkg/migration/migrationcluster/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

func TestNodesString(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()

ns := func(ids ...int) Nodes {
var nodes []Node
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestNodesString(t *testing.T) {
}

func TestNodesIdentical(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()

list := func(nodes ...string) Nodes { // takes in strings of the form "ID@Epoch"
var ns []Node
Expand Down
2 changes: 1 addition & 1 deletion pkg/migration/migrations/truncated_state_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func TestTruncatedStateMigration(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
ctx := context.Background()

for _, testCase := range []struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/diagnostics/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = kvtenantccl.Connector{}
const elemName = "somestring"

func TestTenantReport(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

rt := startReporterTest(t)
Expand Down Expand Up @@ -100,7 +100,7 @@ func TestTenantReport(t *testing.T) {
// TestServerReport checks nodes, stores, localities, and zone configs.
// Telemetry metrics are checked in datadriven tests (see sql.TestTelemetry).
func TestServerReport(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

rt := startReporterTest(t)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/log/fluent_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func TestFluentClient(t *testing.T) {
defer leaktest.AfterTest(t)
defer leaktest.AfterTest(t)()
sc := Scope(t)
defer sc.Close(t)

Expand Down
8 changes: 4 additions & 4 deletions pkg/util/stop/stopper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func maybePrint(context.Context) {
}

func BenchmarkDirectCall(b *testing.B) {
defer leaktest.AfterTest(b)
defer leaktest.AfterTest(b)()
s := stop.NewStopper()
ctx := context.Background()
defer s.Stop(ctx)
Expand All @@ -602,7 +602,7 @@ func BenchmarkDirectCall(b *testing.B) {
}

func BenchmarkStopper(b *testing.B) {
defer leaktest.AfterTest(b)
defer leaktest.AfterTest(b)()
ctx := context.Background()
s := stop.NewStopper()
defer s.Stop(ctx)
Expand All @@ -613,7 +613,7 @@ func BenchmarkStopper(b *testing.B) {
}
}
func BenchmarkDirectCallPar(b *testing.B) {
defer leaktest.AfterTest(b)
defer leaktest.AfterTest(b)()
s := stop.NewStopper()
ctx := context.Background()
defer s.Stop(ctx)
Expand All @@ -625,7 +625,7 @@ func BenchmarkDirectCallPar(b *testing.B) {
}

func BenchmarkStopperPar(b *testing.B) {
defer leaktest.AfterTest(b)
defer leaktest.AfterTest(b)()
ctx := context.Background()
s := stop.NewStopper()
defer s.Stop(ctx)
Expand Down

0 comments on commit fdfcf23

Please sign in to comment.