github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/br_log_test/run.sh (about)

     1  #!/bin/sh
     2  #
     3  # Copyright 2019 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  set -eu
    17  DB="$TEST_NAME"
    18  TABLE="usertable"
    19  DB_COUNT=3
    20  
    21  for i in $(seq $DB_COUNT); do
    22      run_sql "CREATE DATABASE $DB${i};"
    23      go-ycsb load mysql -P tests/$TEST_NAME/workload -p mysql.host=$TIDB_IP -p mysql.port=$TIDB_PORT -p mysql.user=root -p mysql.db=$DB${i}
    24  done
    25  
    26  for i in $(seq $DB_COUNT); do
    27      row_count_ori[${i}]=$(run_sql "SELECT COUNT(*) FROM $DB${i}.$TABLE;" | awk '/COUNT/{print $2}')
    28  done
    29  
    30  echo "backup with tikv permission error start..." 
    31  export GO_FAILPOINTS="github.com/pingcap/br/pkg/backup/tikv-rw-error=return(\"Io(Os { code: 13, kind: PermissionDenied...})\")"
    32  run_br --pd $PD_ADDR backup full -s "local://$TEST_DIR/$DB-tikverr" || echo "br log test done!"
    33  export GO_FAILPOINTS=""
    34  
    35  echo "backup with tikv file or directory not found error start..."
    36  export GO_FAILPOINTS="github.com/pingcap/br/pkg/backup/tikv-rw-error=return(\"Io(Os { code: 2, kind:NotFound...})\")"
    37  run_br --pd $PD_ADDR backup full -s "local://$TEST_DIR/$DB-tikverr2" || echo "br log test done!"
    38  export GO_FAILPOINTS=""
    39  
    40  
    41  for i in $(seq $DB_COUNT); do
    42      run_sql "DROP DATABASE $DB${i};"
    43  done