vitess.io/vitess@v0.16.2/test/region_example.sh (about) 1 #!/bin/bash 2 3 # Copyright 2020 The Vitess Authors. 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 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # This test runs through the scripts in examples/region_sharding to make sure they work. 18 # It should be kept in sync with the steps in https://vitess.io/docs/user-guides/region-sharding/ 19 # So we can detect if a regression affecting a tutorial is introduced. 20 21 source build.env 22 23 set -xeo pipefail 24 25 cd "$VTROOT/examples/region_sharding" 26 unset VTROOT # ensure that the examples can run without VTROOT now. 27 28 source ../common/env.sh # Required so that "mysql" works from alias 29 30 ./101_initial_cluster.sh 31 32 sleep 5 # Give vtgate time to really start. 33 34 mysql < insert_customers.sql 35 mysql --table < show_initial_data.sql 36 37 # create schema and vschema for sharding (+lookup vindex) 38 ./201_main_sharded.sh 39 40 # bring up shards and tablets 41 ./202_new_tablets.sh 42 43 # reshard 44 ./203_reshard.sh 45 46 sleep 5 # Give reshard time to finish copying 47 48 # SwitchReads 49 50 sleep 5 # wait for workflow to run 51 52 ./204_switch_reads.sh 53 54 # SwitchWrites 55 ./205_switch_writes.sh 56 57 # down shard 58 ./206_down_shard_0.sh 59 60 # delete shard 0 61 ./207_delete_shard_0.sh 62 63 # Down cluster 64 ./301_teardown.sh