Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: clean up after tests #2641

Merged
merged 1 commit into from
Sep 23, 2015
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
12 changes: 0 additions & 12 deletions rpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,9 @@ import (
"github.com/cockroachdb/cockroach/util"
"github.com/cockroachdb/cockroach/util/hlc"
"github.com/cockroachdb/cockroach/util/leaktest"
"github.com/cockroachdb/cockroach/util/retry"
"github.com/cockroachdb/cockroach/util/stop"
)

func init() {
// Setting these in individual tests triggers the race detector, so
// this is better for now.
// TODO(tamird): stop doing this.
heartbeatInterval = 10 * time.Millisecond
clientRetryOptions = retry.Options{
InitialBackoff: 1 * time.Millisecond,
MaxBackoff: 1 * time.Millisecond,
}
}

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

Expand Down
13 changes: 13 additions & 0 deletions rpc/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ package rpc

import (
"testing"
"time"

"github.com/cockroachdb/cockroach/security"
"github.com/cockroachdb/cockroach/security/securitytest"
"github.com/cockroachdb/cockroach/testutils"
"github.com/cockroachdb/cockroach/util/hlc"
"github.com/cockroachdb/cockroach/util/leaktest"
"github.com/cockroachdb/cockroach/util/retry"
"github.com/cockroachdb/cockroach/util/stop"
)

Expand All @@ -44,5 +46,16 @@ func init() {
//go:generate ../util/leaktest/add-leaktest.sh *_test.go

func TestMain(m *testing.M) {
defer func(hbInterval time.Duration, retryOpts retry.Options) {
heartbeatInterval = hbInterval
clientRetryOptions = retryOpts
}(heartbeatInterval, clientRetryOptions)

heartbeatInterval = 10 * time.Millisecond
clientRetryOptions = retry.Options{
InitialBackoff: 1 * time.Millisecond,
MaxBackoff: 1 * time.Millisecond,
}

leaktest.TestMainWithLeakCheck(m)
}