Skip to content

Commit

Permalink
server: TestTelemetrySQLStatsIndependence uses test reg server
Browse files Browse the repository at this point in the history
Previously, this test hit the real registration server which caused
goroutine leaks when the reg server was unavailable.

The test now creates a test reg server to handle the stats calls.
The test is no longer skipped.

Resolves #63851

Release note: None
  • Loading branch information
dhartunian committed Jun 14, 2021
1 parent 7a68e6e commit 81d8cc2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/server/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sqlstats"
"github.com/cockroachdb/cockroach/pkg/sql/tests"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/diagutils"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
Expand All @@ -39,13 +39,19 @@ func TestTelemetrySQLStatsIndependence(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

// This test fails if the central reporting server from CRL
// breaks. It should be improved to customize the reporting URL and
// mock the registration collector with an in-memory server.
skip.WithIssue(t, 63851)

ctx := context.Background()
params, _ := tests.CreateTestServerParams()

r := diagutils.NewServer()
defer r.Close()

url := r.URL()
params.Knobs.Server = &TestingKnobs{
DiagnosticsTestingKnobs: diagnostics.TestingKnobs{
OverrideReportingURL: &url,
},
}

s, sqlDB, _ := serverutils.StartServer(t, params)
defer s.Stopper().Stop(ctx)

Expand Down

0 comments on commit 81d8cc2

Please sign in to comment.