Skip to content

Commit

Permalink
fix some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Nov 27, 2023
1 parent d69d582 commit d4a04e8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions cdc/api/v2/api_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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{}
Expand Down
4 changes: 2 additions & 2 deletions cdc/owner/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions cdc/owner/ddl_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions cdc/owner/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cdc/sink/dmlsink/mq/mq_dml_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)`
Expand Down
8 changes: 4 additions & 4 deletions cdc/sink/dmlsink/mq/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down Expand Up @@ -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)`
Expand Down Expand Up @@ -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)`
Expand Down Expand Up @@ -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)`
Expand Down

0 comments on commit d4a04e8

Please sign in to comment.