Skip to content

Commit

Permalink
tests: stabilize integration test (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXiangUSTC authored and july2993 committed Mar 25, 2019
1 parent 8a5559e commit 09c3bd1
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/_utils/run_pump
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ while :
do
pump_num=`ps aux > temp && grep "pump -log-file ${OUT_DIR}/pump_${PORT}.log" temp | wc -l && rm temp`
if [ $pump_num -ne 0 ]; then
binlogctl -pd-urls 127.0.0.1:2379 -cmd pause-pump -node-id pump:$PORT
binlogctl -pd-urls 127.0.0.1:2379 -cmd pause-pump -node-id pump:$PORT || true
sleep 1
else
break
Expand Down
4 changes: 2 additions & 2 deletions tests/binlog/drainer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ pd-urls = "http://127.0.0.1:2379"
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql"

# number of binlog events in a transaction batch
txn-batch = 1
txn-batch = 200

# work count to execute binlogs
worker-count = 1
worker-count = 20

disable-dispatch = false

Expand Down
6 changes: 3 additions & 3 deletions tests/reparo/drainer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ pd-urls = "http://127.0.0.1:2379"
[syncer]

# disable sync these schema
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql"
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql,test"

# number of binlog events in a transaction batch
txn-batch = 1
txn-batch = 200

# work count to execute binlogs
worker-count = 1
worker-count = 20

disable-dispatch = false

Expand Down
9 changes: 8 additions & 1 deletion tests/reparo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ set -e

cd "$(dirname "$0")"

run_drainer &
# use latest ts as initial-commit-ts, so we can skip binlog by previous test case
ms=$(date +'%s')
ts=$(($ms*1000<<18))
args="-initial-commit-ts=$ts"
down_run_sql "DROP DATABASE IF EXISTS tidb_binlog"
rm -rf /tmp/tidb_binlog_test/data.drainer

run_drainer "$args" &

run_sql "DROP DATABASE IF EXISTS \`reparo_test\`;"
run_sql "CREATE DATABASE \`reparo_test\`"
Expand Down
6 changes: 3 additions & 3 deletions tests/restart/drainer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ pd-urls = "http://127.0.0.1:2379"
[syncer]

# disable sync these schema
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql"
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql,test"

# number of binlog events in a transaction batch
txn-batch = 1
txn-batch = 200

# work count to execute binlogs
worker-count = 1
worker-count = 20

disable-dispatch = false

Expand Down
12 changes: 11 additions & 1 deletion tests/restart/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ OUT_DIR=/tmp/tidb_binlog_test
STATUS_LOG="${OUT_DIR}/status.log"

# run drainer, and drainer's status should be online
run_drainer &
# use latest ts as initial-commit-ts, so we can skip binlog by previous test case
ms=$(date +'%s')
ts=$(($ms*1000<<18))
args="-initial-commit-ts=$ts"
down_run_sql "DROP DATABASE IF EXISTS tidb_binlog"
rm -rf /tmp/tidb_binlog_test/data.drainer

run_drainer "$args" &
sleep 5

# run a new pump
run_pump 8251 &
Expand All @@ -21,6 +29,8 @@ sleep 5
run_pump 8250 &
run_pump 8251 &

sleep 5

echo "Verifying TiDB is alive..."
mysql -uroot -h127.0.0.1 -P4000 --default-character-set utf8 -e 'select * from mysql.tidb;'
if [ $? -ne 0 ]; then
Expand Down
5 changes: 4 additions & 1 deletion tests/status/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ sleep 2
echo "check drainer's status, should be online"
check_status drainers online

drainerNodeID=`cat $STATUS_LOG | sed 's/.*NodeID: \([a-zA-Z0-9\-]*:[0-9]*\),.*/\1/g'`
# TODO improve it, let binlogctl output formatted data
drainerNodeID=`cat $STATUS_LOG | sed 's/.*NodeID: \(.*:[0-9]*\), Addr:.*/\1/g'`
echo "get drainer node id: $drainerNodeID"

pumpNodeID="pump:8250"

# pump's state should be online
Expand Down

0 comments on commit 09c3bd1

Please sign in to comment.