From d4a04e8c54512214844b1dcca259fd2f1b91a537 Mon Sep 17 00:00:00 2001 From: 3AceShowHand Date: Thu, 23 Nov 2023 18:35:49 +0800 Subject: [PATCH] fix some tests. --- cdc/api/v2/api_helpers_test.go | 4 ++-- cdc/owner/changefeed_test.go | 4 ++-- cdc/owner/ddl_manager_test.go | 6 +++--- cdc/owner/schema_test.go | 16 ++++++++-------- cdc/sink/dmlsink/mq/mq_dml_sink_test.go | 2 +- .../columnselector/column_selector_test.go | 4 ++-- cdc/sink/dmlsink/mq/worker_test.go | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cdc/api/v2/api_helpers_test.go b/cdc/api/v2/api_helpers_test.go index 5448f66d467..6f06fe52da0 100644 --- a/cdc/api/v2/api_helpers_test.go +++ b/cdc/api/v2/api_helpers_test.go @@ -30,7 +30,7 @@ import ( func TestVerifyCreateChangefeedConfig(t *testing.T) { ctx := context.Background() pdClient := &mockPDClient{} - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) helper.Tk().MustExec("use test;") storage := helper.Storage() ctrl := mock_controller.NewMockController(gomock.NewController(t)) @@ -111,7 +111,7 @@ func TestVerifyUpdateChangefeedConfig(t *testing.T) { Config: config.GetDefaultReplicaConfig(), } oldUpInfo := &model.UpstreamInfo{} - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) helper.Tk().MustExec("use test;") storage := helper.Storage() h := &APIV2HelpersImpl{} diff --git a/cdc/owner/changefeed_test.go b/cdc/owner/changefeed_test.go index 15d05ce4a04..9794fb60e85 100644 --- a/cdc/owner/changefeed_test.go +++ b/cdc/owner/changefeed_test.go @@ -314,7 +314,7 @@ func TestChangefeedHandleError(t *testing.T) { } func TestExecDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() // Creates a table, which will be deleted at the start-ts of the changefeed. // It is expected that the changefeed DOES NOT replicate this table. @@ -399,7 +399,7 @@ func TestExecDDL(t *testing.T) { } func TestEmitCheckpointTs(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() // Creates a table, which will be deleted at the start-ts of the changefeed. // It is expected that the changefeed DOES NOT replicate this table. diff --git a/cdc/owner/ddl_manager_test.go b/cdc/owner/ddl_manager_test.go index 80bea1e6ed3..d7a198f4803 100644 --- a/cdc/owner/ddl_manager_test.go +++ b/cdc/owner/ddl_manager_test.go @@ -158,7 +158,7 @@ func TestGetSnapshotTs(t *testing.T) { } func TestExecRenameTablesDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ctx := cdcContext.NewBackendContext4Test(true) dm := createDDLManagerForTest(t) @@ -258,7 +258,7 @@ func TestExecRenameTablesDDL(t *testing.T) { } func TestExecDropTablesDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ctx := cdcContext.NewBackendContext4Test(true) dm := createDDLManagerForTest(t) @@ -322,7 +322,7 @@ func TestExecDropTablesDDL(t *testing.T) { } func TestExecDropViewsDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ctx := cdcContext.NewBackendContext4Test(true) dm := createDDLManagerForTest(t) diff --git a/cdc/owner/schema_test.go b/cdc/owner/schema_test.go index b39a21a2397..fe74898bee2 100644 --- a/cdc/owner/schema_test.go +++ b/cdc/owner/schema_test.go @@ -33,7 +33,7 @@ import ( var dummyChangeFeedID = model.DefaultChangeFeedID("dummy_changefeed") func TestAllPhysicalTables(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) require.Nil(t, err) @@ -91,7 +91,7 @@ func TestAllPhysicalTables(t *testing.T) { } func TestAllTables(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) require.Nil(t, err) @@ -130,7 +130,7 @@ func TestAllTables(t *testing.T) { } func TestIsIneligibleTableID(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) require.Nil(t, err) @@ -188,7 +188,7 @@ func compareEvents(t *testing.T, e1, e2 *model.DDLEvent) { } func TestBuildDDLEventsFromSingleTableDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) require.Nil(t, err) @@ -263,7 +263,7 @@ func TestBuildDDLEventsFromSingleTableDDL(t *testing.T) { } func TestBuildDDLEventsFromRenameTablesDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) @@ -391,7 +391,7 @@ func TestBuildDDLEventsFromRenameTablesDDL(t *testing.T) { } func TestBuildDDLEventsFromDropTablesDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) @@ -494,7 +494,7 @@ func TestBuildDDLEventsFromDropTablesDDL(t *testing.T) { } func TestBuildDDLEventsFromDropViewsDDL(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) @@ -615,7 +615,7 @@ func TestBuildDDLEventsFromDropViewsDDL(t *testing.T) { } func TestBuildIgnoredDDLJob(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() ver, err := helper.Storage().CurrentVersion(oracle.GlobalTxnScope) diff --git a/cdc/sink/dmlsink/mq/mq_dml_sink_test.go b/cdc/sink/dmlsink/mq/mq_dml_sink_test.go index bd27c61a7ff..3f66d886b5e 100644 --- a/cdc/sink/dmlsink/mq/mq_dml_sink_test.go +++ b/cdc/sink/dmlsink/mq/mq_dml_sink_test.go @@ -80,7 +80,7 @@ func TestWriteEvents(t *testing.T) { require.NotNil(t, s) defer s.Close() - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t(a varchar(255) primary key)` diff --git a/cdc/sink/dmlsink/mq/transformer/columnselector/column_selector_test.go b/cdc/sink/dmlsink/mq/transformer/columnselector/column_selector_test.go index feb49a24e7e..c308caef868 100644 --- a/cdc/sink/dmlsink/mq/transformer/columnselector/column_selector_test.go +++ b/cdc/sink/dmlsink/mq/transformer/columnselector/column_selector_test.go @@ -92,7 +92,7 @@ func TestNewColumnSelector(t *testing.T) { } func TestVerifyTables(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t1( @@ -262,7 +262,7 @@ func TestVerifyTablesColumnFilteredInDispatcher(t *testing.T) { eventRouter, err := dispatcher.NewEventRouter(replicaConfig, config.ProtocolDefault, "default", "default") require.NoError(t, err) - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t1(a int primary key, b int, c int)` diff --git a/cdc/sink/dmlsink/mq/worker_test.go b/cdc/sink/dmlsink/mq/worker_test.go index d3f7c6b3b32..a98177909fa 100644 --- a/cdc/sink/dmlsink/mq/worker_test.go +++ b/cdc/sink/dmlsink/mq/worker_test.go @@ -62,7 +62,7 @@ func newNonBatchEncodeWorker(ctx context.Context, t *testing.T) (*worker, dmlpro } func TestNonBatchEncode_SendMessages(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t(a varchar(255) primary key)` @@ -263,7 +263,7 @@ func TestBatchEncode_Group(t *testing.T) { } func TestBatchEncode_GroupWhenTableStopping(t *testing.T) { - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t(a varchar(255) primary key)` @@ -357,7 +357,7 @@ func TestBatchEncode_SendMessages(t *testing.T) { worker, p := newBatchEncodeWorker(ctx, t) defer worker.close() - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t(a varchar(255) primary key)` @@ -516,7 +516,7 @@ func TestNonBatchEncode_SendMessagesWhenTableStopping(t *testing.T) { replicatingStatus := state.TableSinkSinking stoppedStatus := state.TableSinkStopping - tk := testkit.New(t) + tk := entry.NewTestKit(t, config.GetDefaultReplicaConfig()) defer tk.Close() sql := `create table test.t(a varchar(255) primary key)`