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

test: bring run-compatibility-test back (#1128) #1135

Merged
merged 3 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/compatibility/data/db1.prepare.sql
Original file line number Diff line number Diff line change
@@ -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');
35 changes: 19 additions & 16 deletions tests/compatibility/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,41 @@ 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

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" \
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/compatibility_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"