github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/docker_compatible_s3/run.sh (about) 1 #!/bin/bash 2 # 3 # Copyright 2020 PingCAP, Inc. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 # This test is used to test compatible for BR restore. 17 set -eux 18 19 BUCKET="test" 20 MINIO_ACCESS_KEY='brs3accesskey' 21 MINIO_SECRET_KEY='brs3secretkey' 22 S3_ENDPOINT=minio:24927 23 S3_KEY="&access-key=$MINIO_ACCESS_KEY&secret-access-key=$MINIO_SECRET_KEY" 24 25 # restore backup data one by one 26 for TAG in ${TAGS}; do 27 echo "restore ${TAG} data starts..." 28 bin/br restore db --db test -s "s3://$BUCKET/bk${TAG}?endpoint=http://$S3_ENDPOINT$S3_KEY" --pd $PD_ADDR 29 row_count=$(run_sql_in_container "SELECT COUNT(*) FROM test.usertable;" | awk '/COUNT/{print $2}') 30 if [ $row_count != $EXPECTED_KVS ]; then 31 echo "restore kv count is not as expected(1000), obtain $row_count" 32 exit 1 33 fi 34 # clean up data for next restoration 35 run_sql_in_container "drop database test;" 36 done