Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
glorv committed May 11, 2021
1 parent 7b061e0 commit f2218cb
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dm/config/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ mysql-instances:
err := taskConfig.Decode(errorTaskConfig1)
// field server-id is not a member of TaskConfig
c.Check(err, NotNil)
c.Assert(err, ErrorMatches, "*line 18: field server-id not found in type config.MySQLInstance.*")
c.Assert(err, ErrorMatches, "*line 17: field server-id not found in type config.MySQLInstance.*")

err = taskConfig.Decode(errorTaskConfig2)
// field name duplicate
Expand Down Expand Up @@ -640,7 +640,7 @@ func (t *testConfig) TestGenAndFromSubTaskConfigs(c *C) {
BinLogPos: 456,
BinLogGTID: "1-1-12,4-4-4",
},
From: source1DBCfg,
From: source1DBCfg,
To: DBConfig{
Host: "127.0.0.1",
Port: 4000,
Expand Down
2 changes: 1 addition & 1 deletion dumpling/dumpling.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (m *Dumpling) Init(ctx context.Context) error {
m.dumpConfig, err = m.constructArgs()
m.detectSQLMode(ctx)
m.dumpConfig.SessionParams["time_zone"] = "+00:00"
m.logger.Info("create dumpling", zap.Stringer("config", m.dumpConfig))
m.logger.Info("create dumpling", zap.Stringer("config", m.dumpConfig))
return err
}

Expand Down
1 change: 0 additions & 1 deletion pkg/utils/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ func (s *testCommonSuite) TestParseTimeZone(c *C) {
"+12:59": 12*time.Hour + 59*time.Minute,
"Asia/Shanghai": 8 * time.Hour,
"UTC": time.Duration(0),
"CST": -1 * 6 * time.Hour,
}
for k, v := range cases {
dur, err := ParseTimeZone(k)
Expand Down
5 changes: 1 addition & 4 deletions syncer/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ func (s *testDBSuite) TestTimezone(c *C) {
err = txn.Commit()
c.Assert(err, IsNil)

location, err := utils.ParseTimeZone(testCase.timezone)
c.Assert(err, IsNil)

idx := 0
for {
if idx >= len(testCase.sqls) {
Expand All @@ -280,7 +277,7 @@ func (s *testDBSuite) TestTimezone(c *C) {
c.Assert(ts.Valid, IsTrue)

raw := ev.Rows[0][1].(string)
data, err := time.ParseInLocation("2006-01-02 15:04:05", raw, location)
data, err := time.ParseInLocation("2006-01-02 15:04:05", raw, time.UTC)
c.Assert(err, IsNil)
c.Assert(data.Unix(), DeepEquals, ts.Int64)
idx++
Expand Down
2 changes: 1 addition & 1 deletion tests/all_mode/data/db1.increment.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ insert into t1 (id, name, info, lat, big1, big2) values (12, 'gentest', '{"id":1

-- test with different session time_zone
SET @@session.time_zone = '+07:00';
insert into t1 (id, name, info) values (13, 'tztest', '{"id": 122}');
insert into t1 (id, name, info) values (13, 'tztest', '{"id": 132}');
1 change: 1 addition & 0 deletions tests/dmctl_basic/conf/get_task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ target-database:
max-allowed-packet: null
session:
tidb_txn_mode: optimistic
time_zone: "+00:00"
security: null
mysql-instances:
- source-id: mysql-replica-01
Expand Down
2 changes: 1 addition & 1 deletion tests/full_mode/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function fail_acquire_global_lock() {
"\"result\": true" 1

cp $cur/conf/dm-task.yaml $WORK_DIR/dm-task.yaml
sed -i '/timezone/i\ignore-checking-items: ["dump_privilege"]' $WORK_DIR/dm-task.yaml
sed -i '/heartbeat-report-interval/i\ignore-checking-items: ["dump_privilege"]' $WORK_DIR/dm-task.yaml
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"start-task $WORK_DIR/dm-task.yaml --remove-meta"

Expand Down
1 change: 1 addition & 0 deletions tests/import_v10x/conf/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ target-database:
tidb_disable_txn_auto_retry: "off"
tidb_retry_limit: "10"
tidb_skip_utf8_check: "1"
time_zone: "+00:00"
security: null
mysql-instances:
- source-id: mysql-replica-01
Expand Down
2 changes: 1 addition & 1 deletion tests/safe_mode/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function consistency_none() {
dmctl_operate_source create $WORK_DIR/source2.yaml $SOURCE_ID2

cp $cur/conf/dm-task.yaml $WORK_DIR/dm-task.yaml
sed -i "/timezone/i\clean-dump-file: false" $WORK_DIR/dm-task.yaml
sed -i "/enable-heartbeat/i\clean-dump-file: false" $WORK_DIR/dm-task.yaml
sed -i "s/extra-args: \"\"/extra-args: \"--consistency none\"/g" $WORK_DIR/dm-task.yaml
dmctl_start_task "$WORK_DIR/dm-task.yaml" "--remove-meta"
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml
Expand Down

0 comments on commit f2218cb

Please sign in to comment.