From 5f240b7e3565fa782de6f05a7f2c716afd3f15ef Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Fri, 28 Jul 2023 19:54:32 +0200 Subject: [PATCH] schemafeed: improve some tests Release note: None --- pkg/ccl/changefeedccl/schemafeed/BUILD.bazel | 1 - pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go | 9 +++------ .../schemafeed/table_event_filter_datadriven_test.go | 9 ++++----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pkg/ccl/changefeedccl/schemafeed/BUILD.bazel b/pkg/ccl/changefeedccl/schemafeed/BUILD.bazel index de4c819c5af9..d8fa22869838 100644 --- a/pkg/ccl/changefeedccl/schemafeed/BUILD.bazel +++ b/pkg/ccl/changefeedccl/schemafeed/BUILD.bazel @@ -72,7 +72,6 @@ go_test( "//pkg/sql/catalog", "//pkg/sql/catalog/descpb", "//pkg/sql/catalog/tabledesc", - "//pkg/sql/pgwire", "//pkg/testutils", "//pkg/testutils/datapathutils", "//pkg/testutils/serverutils", diff --git a/pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go b/pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go index c3e2fdb00799..81505250ce61 100644 --- a/pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go +++ b/pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go @@ -24,7 +24,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" - "github.com/cockroachdb/cockroach/pkg/sql/pgwire" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" @@ -197,7 +196,7 @@ func TestFetchDescriptorVersionsCPULimiterPagination(t *testing.T) { ctx := context.Background() var numRequests int first := true - s, db, _ := serverutils.StartServer(t, base.TestServerArgs{ + srv, db, _ := serverutils.StartServer(t, base.TestServerArgs{ Knobs: base.TestingKnobs{Store: &kvserver.StoreTestingKnobs{ TestingRequestFilter: func(ctx context.Context, request *kvpb.BatchRequest) *kvpb.Error { for _, ru := range request.Requests { @@ -220,11 +219,9 @@ func TestFetchDescriptorVersionsCPULimiterPagination(t *testing.T) { }, }}, }) - defer s.Stopper().Stop(ctx) + defer srv.Stopper().Stop(ctx) + s := srv.ApplicationLayer() sqlServer := s.SQLServer().(*sql.Server) - if len(s.TestTenants()) != 0 { - sqlServer = s.TestTenants()[0].PGServer().(*pgwire.Server).SQLServer - } sqlDB := sqlutils.MakeSQLRunner(db) beforeCreate := hlc.Timestamp{WallTime: timeutil.Now().UnixNano()} diff --git a/pkg/ccl/changefeedccl/schemafeed/table_event_filter_datadriven_test.go b/pkg/ccl/changefeedccl/schemafeed/table_event_filter_datadriven_test.go index 587072202c11..19095457818f 100644 --- a/pkg/ccl/changefeedccl/schemafeed/table_event_filter_datadriven_test.go +++ b/pkg/ccl/changefeedccl/schemafeed/table_event_filter_datadriven_test.go @@ -64,12 +64,11 @@ func TestDataDriven(t *testing.T) { testData := datapathutils.TestDataPath(t, "") datadriven.Walk(t, testData, func(t *testing.T, path string) { ctx := context.Background() - ts, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{ - // TODO(ajwerner): Otherwise the test gets skipped due to some CCL warning. - DefaultTestTenant: base.TODOTestTenantDisabled, - }) + srv, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{}) + defer srv.Stopper().Stop(ctx) + ts := srv.ApplicationLayer() + tdb := sqlutils.MakeSQLRunner(sqlDB) - defer ts.Stopper().Stop(ctx) ctx, cancel := ts.Stopper().WithCancelOnQuiesce(ctx) defer cancel() schemaFeeds := map[int]schemafeed.SchemaFeed{}