Skip to content

Commit

Permalink
test: fix integration tests timezone (#438)
Browse files Browse the repository at this point in the history
* fix integration tests timezone

* set sql_mode before start test

* add sleep to waiting global variable cache invalidation

* use insert instead of mydumper+loader
  • Loading branch information
glorv authored May 18, 2021
1 parent 1f111aa commit 75ef6bb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/sync_diff_inspector/time_zone/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ set -e
cd "$(dirname "$0")"
OUT_DIR=/tmp/tidb_tools_test/sync_diff_inspector

mysql -uroot -h 127.0.0.1 -P 4000 -e "create database if not exists tz_test"
mysql -uroot -h 127.0.0.1 -P 4000 -e "create table tz_test.diff(id int, dt datetime, ts timestamp);"
mysql -uroot -h 127.0.0.1 -P 4000 -e "insert into table tz_test.diff values (1, now(), now());"
mysql -uroot -h 127.0.0.1 -P 4000 -e "SET @@GLOBAL.SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';"
sleep 3

echo "dump data and then load to tidb"
rm -rf $OUT_DIR/dump_tz_diff
mydumper --host 127.0.0.1 --port 4000 --user root --outputdir $OUT_DIR/dump_tz_diff -B tz_test -T diff
loader -h 127.0.0.1 -P 4001 -u root -d $OUT_DIR/dump_tz_diff
for port in 4000 4001; do
mysql -uroot -h 127.0.0.1 -P $port -e "create database if not exists tz_test"
mysql -uroot -h 127.0.0.1 -P $port -e "create table tz_test.diff(id int, dt datetime, ts timestamp);"
mysql -uroot -h 127.0.0.1 -P $port -e "insert into tz_test.diff values (1, '2020-05-17 09:12:13', '2020-05-17 09:12:13');"
done

echo "check with the same time_zone, check result should be pass"
sync_diff_inspector --config=./config.toml > $OUT_DIR/time_zone_diff.log
Expand All @@ -21,6 +21,8 @@ check_contains "check pass!!!" $OUT_DIR/time_zone_diff.log
# check upstream and downstream time_zone
mysql -uroot -h 127.0.0.1 -P 4000 -e "SET @@global.time_zone = '+08:00'";
mysql -uroot -h 127.0.0.1 -P 4001 -e "SET @@global.time_zone = '+00:00'";
sleep 5

echo "check with different time_zone, check result should be pass again"
sync_diff_inspector --config=./config.toml > $OUT_DIR/time_zone_diff.log
check_contains "check pass!!!" $OUT_DIR/time_zone_diff.log
Expand Down

0 comments on commit 75ef6bb

Please sign in to comment.