Skip to content

Commit

Permalink
schemafeed: improve some tests
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
knz committed Jul 28, 2023
1 parent 2d47570 commit 5f240b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion pkg/ccl/changefeedccl/schemafeed/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 3 additions & 6 deletions pkg/ccl/changefeedccl/schemafeed/schema_feed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 5f240b7

Please sign in to comment.