From 9dcf0eba53e8b3dfcc612615ee5f22bcf3492f91 Mon Sep 17 00:00:00 2001 From: joccau Date: Mon, 28 Mar 2022 20:35:10 +0800 Subject: [PATCH] maintain test case Signed-off-by: joccau --- br/pkg/task/restore.go | 2 +- .../br_check_new_collocation_enable/run.sh | 27 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 76e90e61afb28..f88440dca6447 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -277,7 +277,7 @@ func CheckNewCollationEnable( if CheckRequirements { return errors.Annotatef(berrors.ErrUnknown, "NewCollactionEnable not found in backupmeta. "+ - "if you ensure the newCollactionEnable config is same as restore cluster, "+ + "if you ensure the NewCollactionEnable config of backup cluster is as same as restore cluster, "+ "use --check-requirements=false to skip") } else { log.Warn("no NewCollactionEnable in backup") diff --git a/br/tests/br_check_new_collocation_enable/run.sh b/br/tests/br_check_new_collocation_enable/run.sh index 08024945d8f2f..d74262148fb5c 100755 --- a/br/tests/br_check_new_collocation_enable/run.sh +++ b/br/tests/br_check_new_collocation_enable/run.sh @@ -17,6 +17,9 @@ set -eu DB="$TEST_NAME" +cur=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source $cur/../_utils/run_services + PROGRESS_FILE="$TEST_DIR/progress_unit_file" rm -rf $PROGRESS_FILE @@ -40,7 +43,7 @@ run_sql "CREATE TABLE $DB.usertable2 ( \ run_sql "INSERT INTO $DB.usertable2 VALUES (\"c\", \"d\");" # backup db -echo "backup start..." +echo "backup start ... with brv4.0.8 without NewCollactionEnable" bin/brv4.0.8 backup db --db "$DB" -s "local://$TEST_DIR/$DB" \ --ca "$TEST_DIR/certs/ca.pem" \ --cert "$TEST_DIR/certs/br.pem" \ @@ -49,10 +52,11 @@ bin/brv4.0.8 backup db --db "$DB" -s "local://$TEST_DIR/$DB" \ --check-requirements=false # restore db from v4.0.8 version without `newCollationEnable` -echo "restore start..." +echo "restore start ... without NewCollactionEnable in backupmeta" restore_fail=0 error_str="NewCollactionEnable not found in backupmeta" -test_log="newCollotionEnabble_test.log" +test_log="new_collotion_enable_test.log" +unset BR_LOG_TO_TERM run_br restore db --db $DB -s "local://$TEST_DIR/$DB" --pd $PD_ADDR --log-file $test_log || restore_fail=1 if [ $restore_fail -ne 1 ]; then echo "TEST: [$TEST_NAME] test restore failed!" @@ -61,20 +65,28 @@ fi if ! grep -i "$error_str" $test_log; then echo "${error_str} not found in log" + echo "TEST: [$TEST_NAME] test restore failed!" exit 1 fi +rm -rf "$test_log" + # backup with NewCollationEable = false echo "Restart cluster with new_collation_enable=false" start_services --tidb-cfg $cur/config/new_collation_enable_false.toml -run_br --pd $PD_ADDR backup db --db "$DB" -s "local://$TEST_DIR/$DB" + +echo "backup start ... witch NewCollactionEnable=false in TiDB" +run_br --pd $PD_ADDR backup db --db "$DB" -s "local://$cur/${DB}_2" echo "Restart cluster with new_collation_enable=true" start_services --tidb-cfg $cur/config/new_collation_enable_true.toml +echo "restore start ... with NewCollactionEnable=True in TiDB" restore_fail=0 +test_log2="new_collotion_enable_test2.log" error_str="newCollationEnable not match" -run_br restore db --db $DB -s "local://$TEST_DIR/$DB" --pd $PD_ADDR --log-file $test_log2 || restore_fail=1 +unset BR_LOG_TO_TERM +run_br restore db --db $DB -s "local://$cur/${DB}_2" --pd $PD_ADDR --log-file $test_log2 || restore_fail=1 if [ $restore_fail -ne 1 ]; then echo "TEST: [$TEST_NAME] test restore failed!" exit 1 @@ -82,8 +94,9 @@ fi if ! grep -i "$error_str" $test_log2; then echo "${error_str} not found in log" + echo "TEST: [$TEST_NAME] test restore failed!" exit 1 fi -# drop database -run_sql "DROP DATABASE $DB;" +rm -rf "$test_log2" +rm -rf "$cur/${DB}_2"