From ebf9b97abbd1517556e5c2f3c77445076524c121 Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Thu, 10 Nov 2022 12:09:51 +0000 Subject: [PATCH] jobs: add log scopes to tests Release note: None --- pkg/jobs/delegate_control_test.go | 7 +++++++ pkg/jobs/lease_test.go | 2 ++ pkg/jobs/registry_test.go | 2 ++ 3 files changed, 11 insertions(+) diff --git a/pkg/jobs/delegate_control_test.go b/pkg/jobs/delegate_control_test.go index 0272f38acec2..e6f2ceb045b5 100644 --- a/pkg/jobs/delegate_control_test.go +++ b/pkg/jobs/delegate_control_test.go @@ -24,12 +24,15 @@ import ( "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/util/leaktest" + "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/timeutil" "github.com/stretchr/testify/require" ) func TestScheduleControl(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + th, cleanup := newTestHelper(t) defer cleanup() @@ -139,6 +142,8 @@ func TestScheduleControl(t *testing.T) { func TestJobsControlForSchedules(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) + th, cleanup := newTestHelperForTables(t, jobstest.UseSystemTables, nil) defer cleanup() @@ -247,6 +252,7 @@ func TestJobsControlForSchedules(t *testing.T) { // jobs prior to executing the control command. func TestFilterJobsControlForSchedules(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) defer ResetConstructors()() argsFn := func(args *base.TestServerArgs) { @@ -327,6 +333,7 @@ func TestFilterJobsControlForSchedules(t *testing.T) { func TestJobControlByType(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) defer ResetConstructors()() argsFn := func(args *base.TestServerArgs) { diff --git a/pkg/jobs/lease_test.go b/pkg/jobs/lease_test.go index ba9c2d027fcf..816882de5ee9 100644 --- a/pkg/jobs/lease_test.go +++ b/pkg/jobs/lease_test.go @@ -20,12 +20,14 @@ import ( "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" "github.com/cockroachdb/cockroach/pkg/util/leaktest" + "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/timeutil" "github.com/stretchr/testify/require" ) func TestJobsTableClaimFamily(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) ctx := context.Background() s, db, _ := serverutils.StartServer(t, base.TestServerArgs{}) diff --git a/pkg/jobs/registry_test.go b/pkg/jobs/registry_test.go index fcc91ad8f60a..543607162ca0 100644 --- a/pkg/jobs/registry_test.go +++ b/pkg/jobs/registry_test.go @@ -972,6 +972,7 @@ func TestRunWithoutLoop(t *testing.T) { func TestJobIdleness(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) ctx := context.Background() intervalOverride := time.Millisecond @@ -1110,6 +1111,7 @@ func TestJobIdleness(t *testing.T) { // allow other job registries in the cluster to claim and run this job. func TestDisablingJobAdoptionClearsClaimSessionID(t *testing.T) { defer leaktest.AfterTest(t)() + defer log.Scope(t).Close(t) intervalOverride := time.Millisecond s, db, _ := serverutils.StartServer(t, base.TestServerArgs{