Skip to content

Commit

Permalink
Add tests for native ssh
Browse files Browse the repository at this point in the history
Signed-off-by: lucklove <[email protected]>
  • Loading branch information
lucklove committed Jul 23, 2020
1 parent 30b30ad commit 6954500
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 49 deletions.
39 changes: 22 additions & 17 deletions tests/tiup-cluster/script/cmd_subtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function cmd_subtest() {

version=$1
test_cdc=$2
native_ssh=$3

name="test_cmd_$RANDOM"
if [ $test_cdc = true ]; then
Expand All @@ -13,40 +14,44 @@ function cmd_subtest() {
topo=./topo/full_without_cdc.yaml
fi

tiup-cluster check $topo -i ~/.ssh/id_rsa --enable-mem --enable-cpu --apply
if [ $native_ssh == true ]; then
client="--native-ssh"
fi

tiup-cluster $client check $topo -i ~/.ssh/id_rsa --enable-mem --enable-cpu --apply

tiup-cluster --yes check $topo -i ~/.ssh/id_rsa
tiup-cluster $client --yes check $topo -i ~/.ssh/id_rsa

tiup-cluster --yes deploy $name $version $topo -i ~/.ssh/id_rsa
tiup-cluster $client --yes deploy $name $version $topo -i ~/.ssh/id_rsa

tiup-cluster list | grep "$name"
tiup-cluster $client list | grep "$name"

tiup-cluster audit | grep "deploy $name $version"
tiup-cluster $client audit | grep "deploy $name $version"

# Get the audit id can check it just runnable
id=`tiup-cluster audit | grep "deploy $name $version" | awk '{print $1}'`
tiup-cluster audit $id
tiup-cluster $client audit $id

tiup-cluster --yes start $name
tiup-cluster $client --yes start $name

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable

# check the data dir of tikv
tiup-cluster exec $name -N 172.19.0.102 --command "grep /home/tidb/deploy/tikv-20160/data /home/tidb/deploy/tikv-20160/scripts/run_tikv.sh"
tiup-cluster exec $name -N 172.19.0.103 --command "grep /home/tidb/my_kv_data /home/tidb/deploy/tikv-20160/scripts/run_tikv.sh"
tiup-cluster $client exec $name -N 172.19.0.102 --command "grep /home/tidb/deploy/tikv-20160/data /home/tidb/deploy/tikv-20160/scripts/run_tikv.sh"
tiup-cluster $client exec $name -N 172.19.0.103 --command "grep /home/tidb/my_kv_data /home/tidb/deploy/tikv-20160/scripts/run_tikv.sh"

# test patch overwrite
tiup-cluster --yes patch $name ~/.tiup/storage/cluster/packages/tidb-$version-linux-amd64.tar.gz -R tidb --overwrite
tiup-cluster $client --yes patch $name ~/.tiup/storage/cluster/packages/tidb-$version-linux-amd64.tar.gz -R tidb --overwrite
# overwrite with the same tarball twice
tiup-cluster --yes patch $name ~/.tiup/storage/cluster/packages/tidb-$version-linux-amd64.tar.gz -R tidb --overwrite
tiup-cluster $client --yes patch $name ~/.tiup/storage/cluster/packages/tidb-$version-linux-amd64.tar.gz -R tidb --overwrite

tiup-cluster --yes stop $name
tiup-cluster $client --yes stop $name

tiup-cluster --yes restart $name
tiup-cluster $client --yes restart $name

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable

tiup-cluster display $name
tiup-cluster $client display $name

tiup-cluster --yes destroy $name
tiup-cluster $client --yes destroy $name
}
25 changes: 15 additions & 10 deletions tests/tiup-cluster/script/scale_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ function scale_core() {
mkdir -p ~/.tiup/bin/

version=$1
native_ssh=$2

if [ $native_ssh == true ]; then
client="--native-ssh"
fi

name="test_scale_core_$RANDOM"
topo=./topo/full_without_cdc.yaml

tiup-cluster --yes deploy $name $version $topo -i ~/.ssh/id_rsa
tiup-cluster $client --yes deploy $name $version $topo -i ~/.ssh/id_rsa

tiup-cluster list | grep "$name"
tiup-cluster $client list | grep "$name"

tiup-cluster --yes start $name
tiup-cluster $client --yes start $name

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable

tiup-cluster display $name
tiup-cluster $client display $name

total_sub_one=18

echo "start scale in tidb"
tiup-cluster --yes scale-in $name -N 172.19.0.101:4000
tiup-cluster $client --yes scale-in $name -N 172.19.0.101:4000
wait_instance_num_reach $name $total_sub_one
echo "start scale out tidb"
tiup-cluster --yes scale-out $name ./topo/full_scale_in_tidb.yaml
tiup-cluster $client --yes scale-out $name ./topo/full_scale_in_tidb.yaml

# echo "start scale in tikv"
# tiup-cluster --yes scale-in $name -N 172.19.0.103:20160
Expand All @@ -33,10 +38,10 @@ function scale_core() {
# tiup-cluster --yes scale-out $name ./topo/full_scale_in_tikv.yaml

echo "start scale in pd"
tiup-cluster --yes scale-in $name -N 172.19.0.103:2379
tiup-cluster $client --yes scale-in $name -N 172.19.0.103:2379
wait_instance_num_reach $name $total_sub_one
echo "start scale out pd"
tiup-cluster --yes scale-out $name ./topo/full_scale_in_pd.yaml
tiup-cluster $client --yes scale-out $name ./topo/full_scale_in_pd.yaml

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable
}
31 changes: 17 additions & 14 deletions tests/tiup-cluster/script/scale_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,48 @@ function scale_tools() {
mkdir -p ~/.tiup/bin/

version=$1
if [ $native_ssh == true ]; then
client="--native-ssh"
fi

name="test_scale_tools_$RANDOM"
topo=./topo/full.yaml

tiup-cluster --yes deploy $name $version $topo -i ~/.ssh/id_rsa
tiup-cluster $client --yes deploy $name $version $topo -i ~/.ssh/id_rsa

tiup-cluster list | grep "$name"
tiup-cluster $client list | grep "$name"

tiup-cluster --yes start $name
tiup-cluster $client --yes start $name

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable

tiup-cluster display $name
tiup-cluster $client display $name

total_sub_one=21

echo "start scale in pump"
tiup-cluster --yes scale-in $name -N 172.19.0.103:8250
tiup-cluster $client --yes scale-in $name -N 172.19.0.103:8250
wait_instance_num_reach $name $total_sub_one
echo "start scale out pump"
tiup-cluster --yes scale-out $name ./topo/full_scale_in_pump.yaml
tiup-cluster $client --yes scale-out $name ./topo/full_scale_in_pump.yaml

echo "start scale in cdc"
yes | tiup-cluster scale-in $name -N 172.19.0.103:8300
yes | tiup-cluster $client scale-in $name -N 172.19.0.103:8300
wait_instance_num_reach $name $total_sub_one
echo "start scale out cdc"
yes | tiup-cluster scale-out $name ./topo/full_scale_in_cdc.yaml
yes | tiup-cluster $client scale-out $name ./topo/full_scale_in_cdc.yaml

echo "start scale in tispark"
yes | tiup-cluster --yes scale-in $name -N 172.19.0.104:7078
yes | tiup-cluster $client --yes scale-in $name -N 172.19.0.104:7078
wait_instance_num_reach $name $total_sub_one
echo "start scale out tispark"
yes | tiup-cluster --yes scale-out $name ./topo/full_scale_in_tispark.yaml
yes | tiup-cluster $client --yes scale-out $name ./topo/full_scale_in_tispark.yaml

echo "start scale in grafana"
tiup-cluster --yes scale-in $name -N 172.19.0.101:3000
tiup-cluster $client --yes scale-in $name -N 172.19.0.101:3000
wait_instance_num_reach $name $total_sub_one
echo "start scale out grafana"
tiup-cluster --yes scale-out $name ./topo/full_scale_in_grafana.yaml
tiup-cluster $client --yes scale-out $name ./topo/full_scale_in_grafana.yaml

tiup-cluster _test $name writable
tiup-cluster $client _test $name writable
}
7 changes: 5 additions & 2 deletions tests/tiup-cluster/test_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -eu

source script/cmd_subtest.sh

echo "test cluster for verision v4.0.2 with CDC"
cmd_subtest v4.0.2 true
echo "test cluster for verision v4.0.2 with CDC, via easy ssh"
cmd_subtest v4.0.2 true false

echo "test cluster for verision v4.0.2 with CDC, via native ssh"
cmd_subtest v4.0.2 true true
7 changes: 5 additions & 2 deletions tests/tiup-cluster/test_cmd_no_cdc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -eu

source script/cmd_subtest.sh

echo "test cluster for verision v4.0.2 without CDC"
cmd_subtest v4.0.2 false
echo "test cluster for verision v4.0.2 without CDC, via easy ssh"
cmd_subtest v4.0.2 false false

echo "test cluster for verision v4.0.2 without CDC, via native ssh"
cmd_subtest v4.0.2 false true
7 changes: 5 additions & 2 deletions tests/tiup-cluster/test_scale_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -eu

source script/scale_core.sh

echo "test scaling of core components in cluster for verision v4.0.2"
scale_core v4.0.2 true
echo "test scaling of core components in cluster for verision v4.0.2, via easy ssh"
scale_core v4.0.2 false

echo "test scaling of core components in cluster for verision v4.0.2, via native ssh"
scale_core v4.0.2 true
7 changes: 5 additions & 2 deletions tests/tiup-cluster/test_scale_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -eu

source script/scale_tools.sh

echo "test scaling of tools components in cluster for verision v4.0.2"
scale_tools v4.0.2 true
echo "test scaling of tools components in cluster for verision v4.0.2, via easy ssh"
scale_tools v4.0.2 false

echo "test scaling of tools components in cluster for verision v4.0.2, via native ssh"
scale_tools v4.0.2 true

0 comments on commit 6954500

Please sign in to comment.