From a8e0cb59bde146a7e49af96c15a8ffb52ca2afe6 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Sat, 19 Aug 2023 11:45:40 +0200 Subject: [PATCH] jobs: remove spurious calls to `settings.TestingSaveRegistry` Release note: None --- pkg/jobs/job_scheduler_test.go | 8 +++----- pkg/jobs/testutils_test.go | 3 --- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/jobs/job_scheduler_test.go b/pkg/jobs/job_scheduler_test.go index f8935a92fb24..2aac6a7f6f13 100644 --- a/pkg/jobs/job_scheduler_test.go +++ b/pkg/jobs/job_scheduler_test.go @@ -201,10 +201,10 @@ func TestJobSchedulerDaemonInitialScanDelay(t *testing.T) { } } -func getScopedSettings() (*settings.Values, func()) { +func getScopedSettings() *settings.Values { sv := &settings.Values{} sv.Init(context.Background(), nil) - return sv, settings.TestingSaveRegistry() + return sv } func TestJobSchedulerDaemonGetWaitPeriod(t *testing.T) { @@ -212,8 +212,7 @@ func TestJobSchedulerDaemonGetWaitPeriod(t *testing.T) { defer log.Scope(t).Close(t) ctx := context.Background() - sv, cleanup := getScopedSettings() - defer cleanup() + sv := getScopedSettings() noJitter := func(d time.Duration) time.Duration { return d } @@ -576,7 +575,6 @@ func TestJobSchedulerRetriesFailed(t *testing.T) { func TestJobSchedulerDaemonUsesSystemTables(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) - defer settings.TestingSaveRegistry()() // Make daemon run quickly. knobs := &TestingKnobs{ diff --git a/pkg/jobs/testutils_test.go b/pkg/jobs/testutils_test.go index c5eb20f78155..f5ba40e8cac7 100644 --- a/pkg/jobs/testutils_test.go +++ b/pkg/jobs/testutils_test.go @@ -20,7 +20,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/jobs/jobstest" "github.com/cockroachdb/cockroach/pkg/scheduledjobs" "github.com/cockroachdb/cockroach/pkg/security/username" - "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/sql/isql" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" @@ -90,7 +89,6 @@ func newTestHelperForTables( sqlDB.Exec(t, jobstest.GetJobsTableSchema(env)) } - restoreRegistry := settings.TestingSaveRegistry() return &testHelper{ env: env, server: s, @@ -107,7 +105,6 @@ func newTestHelperForTables( sqlDB.Exec(t, "DROP TABLE "+env.ScheduledJobsTableName()) } s.Stopper().Stop(context.Background()) - restoreRegistry() } }