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

tests: add a simple test case showing independent VIEWs can be backed up and restored #138

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ programs.

## Preparations

1. The following 6 executables must be copied or linked into these locations:
1. The following 5 executables must be copied or linked into these locations:
* `bin/tidb-server`
* `bin/tikv-server`
* `bin/pd-server`
* `bin/tikv-server`
* `bin/pd-server`
* `bin/pd-ctl`
* `bin/go-ycsb`
* `bin/go-ycsb`

The versions must be ≥2.1.0 as usual.

Expand Down
33 changes: 33 additions & 0 deletions tests/br_view/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
#
# Copyright 2020 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

set -eu
DB="$TEST_NAME"

run_sql "create schema $DB;"
run_sql "create view $DB.test_backup_view as select 133;"

echo "backup start..."
run_br backup db --db "$DB" -s "local://$TEST_DIR/$DB" --pd $PD_ADDR

run_sql "drop schema $DB;"

echo "restore start..."
run_br restore db --db $DB -s "local://$TEST_DIR/$DB" --pd $PD_ADDR

restored=$(run_sql "select * from $DB.test_backup_view;" | awk '/133/{print $2}')
[ $restored = '133' ]

run_sql "drop schema $DB;"