From 41cbe7f16fb9b5b250daf345a161a7cddda49236 Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Mon, 12 Oct 2020 15:10:29 +0800 Subject: [PATCH] cherry pick #1128 to release-2.0 (#1135) --- Makefile | 10 +++---- tests/compatibility/data/db1.prepare.sql | 2 +- tests/compatibility/start.sh | 35 +++++++++++++----------- tests/compatibility_run.sh | 1 + 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 649f75bcdc..98f874945f 100644 --- a/Makefile +++ b/Makefile @@ -181,12 +181,10 @@ integration_test: check_third_party_binary tests/run.sh $(CASE) compatibility_test: check_third_party_binary - @which bin/dm-master.test - @which bin/dm-worker.test - cp bin/dm-master.test bin/dm-master.test.current - cp bin/dm-worker.test bin/dm-worker.test.current - cp bin/dm-master.test bin/dm-master.test.previous - cp bin/dm-worker.test bin/dm-worker.test.previous + @which bin/dm-master.test.current + @which bin/dm-worker.test.current + @which bin/dm-master.test.previous + @which bin/dm-worker.test.previous tests/compatibility_run.sh ${CASE} # unify cover mode in coverage files, more details refer to tests/_utils/run_dm_ctl diff --git a/tests/compatibility/data/db1.prepare.sql b/tests/compatibility/data/db1.prepare.sql index 81bff8323c..c2b101f5e4 100644 --- a/tests/compatibility/data/db1.prepare.sql +++ b/tests/compatibility/data/db1.prepare.sql @@ -1,5 +1,5 @@ drop database if exists `compatibility`; create database `compatibility`; use `compatibility`; -create table t1 (id int, name varchar(20)); +create table t1 (id int, name varchar(20), primary key (`id`)); insert into t1 (id, name) values (1, 'arya'), (2, 'catelyn'); diff --git a/tests/compatibility/start.sh b/tests/compatibility/start.sh index a112690644..7f940c4926 100755 --- a/tests/compatibility/start.sh +++ b/tests/compatibility/start.sh @@ -13,12 +13,14 @@ function run() { check_contains 'Query OK, 3 rows affected' echo "use previous dm-master and dm-worker" + run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml previous + check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml previous check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $cur/conf/dm-worker2.toml previous check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER2_PORT - run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml previous - check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT + dmctl_operate_source create $cur/conf/source1.yaml $SOURCE_ID1 + dmctl_operate_source create $cur/conf/source2.yaml $SOURCE_ID2 echo "start DM task only" dmctl_start_task @@ -26,25 +28,26 @@ function run() { echo "use sync_diff_inspector to check full dump loader" check_sync_diff $WORK_DIR $cur/conf/diff_config.toml - pkill -hup dm-worker.test.previous 2>/dev/null || true - wait_process_exit dm-worker.test.previous - - echo "restart dm-worker, one use the current version, and the other one use the previous version" - run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml current - run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $cur/conf/dm-worker2.toml previous + # upgrading should firstly upgrade master + echo "use current dm-master" + pkill -hup dm-master.test.previous 2>/dev/null || true + wait_process_exit dm-master.test.previous + run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml current + check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT run_sql_file $cur/data/db1.increment.1.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 run_sql_file $cur/data/db2.increment.1.sql $MYSQL_HOST2 $MYSQL_PORT2 $MYSQL_PASSWORD2 echo "use sync_diff_inspector to check increment data first time" check_sync_diff $WORK_DIR $cur/conf/diff_config.toml - - echo "use current dm-master" - pkill -hup dm-master.test.previous 2>/dev/null || true - wait_process_exit dm-master.test.previous - run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml current - check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT - sleep 3 + + echo "restart dm-worker, one use the current version, and the other one use the previous version" + pkill -hup dm-worker.test.previous 2>/dev/null || true + wait_process_exit dm-worker.test.previous + run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml current + check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT + run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $cur/conf/dm-worker2.toml previous + check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER2_PORT echo "pause task and check status" run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ @@ -65,7 +68,7 @@ function run() { run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status test" \ - "\"stage\": \"Running\"" 4 + "\"stage\": \"Running\"" 2 echo "use sync_diff_inspector to check data second time" check_sync_diff $WORK_DIR $cur/conf/diff_config.toml diff --git a/tests/compatibility_run.sh b/tests/compatibility_run.sh index 88d45599a1..1487a1f3a2 100755 --- a/tests/compatibility_run.sh +++ b/tests/compatibility_run.sh @@ -35,3 +35,4 @@ cp $PWD/bin/dm-master.test.previous $PWD/bin/dm-master.test cp $PWD/bin/dm-worker.test.current $PWD/bin/dm-worker.test run "$test_case" +