From 8592330e476126bc77d5da38d00c3e32de952261 Mon Sep 17 00:00:00 2001 From: 9547 Date: Tue, 17 Nov 2020 06:55:36 +0800 Subject: [PATCH] test(cluster,dm): test public key should be deleted from remote --- tests/tiup-cluster/script/cmd_subtest.sh | 5 +++++ tests/tiup-cluster/script/scale_core.sh | 2 ++ tests/tiup-dm/test_cmd.sh | 11 ++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/tiup-cluster/script/cmd_subtest.sh b/tests/tiup-cluster/script/cmd_subtest.sh index cc1ff0e929..e32d4edc8a 100755 --- a/tests/tiup-cluster/script/cmd_subtest.sh +++ b/tests/tiup-cluster/script/cmd_subtest.sh @@ -104,5 +104,10 @@ function cmd_subtest() { ! tiup-cluster $client _test $name data + cp "~/.tiup/storage/cluster/$name/ssh/id_rsa" "/tmp/$name.id_rsa" tiup-cluster $client --yes destroy $name + + # after destroy the cluster, the public key should be deleted + ! ssh -i "/tmp/$name.id_rsa" tidb@$ipprefix.101 "ls" + unlink "/tmp/$name.id_rsa" } diff --git a/tests/tiup-cluster/script/scale_core.sh b/tests/tiup-cluster/script/scale_core.sh index 8936aaccf8..a031939009 100755 --- a/tests/tiup-cluster/script/scale_core.sh +++ b/tests/tiup-cluster/script/scale_core.sh @@ -78,6 +78,8 @@ function scale_core() { ! tiup-cluster $client exec $name -N $ipprefix.102 --command "ls /home/tidb/deploy/monitor-9100/deploy/monitor-9100" ! tiup-cluster $client exec $name -N $ipprefix.102 --command "ps aux | grep node_exporter | grep -qv grep" ! tiup-cluster $client exec $name -N $ipprefix.102 --command "ps aux | grep blackbox_exporter | grep -qv grep" + # public key should be deleted + ! ssh -i "~/.tiup/storage/cluster/$name/ssh/id_rsa" tidb@$ipprefix.102 "ls" echo "start scale out tidb" topo=./topo/full_scale_in_tidb.yaml diff --git a/tests/tiup-dm/test_cmd.sh b/tests/tiup-dm/test_cmd.sh index f2fb070ace..216f1c6445 100755 --- a/tests/tiup-dm/test_cmd.sh +++ b/tests/tiup-dm/test_cmd.sh @@ -54,8 +54,8 @@ total_sub_one=12 echo "start scale in dm-master" tiup-dm --yes scale-in $name -N $ipprefix.101:8261 wait_instance_num_reach $name $total_sub_one false -echo "start scale out dm-master" +echo "start scale out dm-master" topo_master=./topo/full_scale_in_dm-master.yaml sed "s/__IPPREFIX__/$ipprefix/g" $topo_master.tpl > $topo_master tiup-dm --yes scale-out $name $topo_master @@ -72,8 +72,13 @@ yes | tiup-dm scale-out $name $topo_worker # test create a task and can replicate data ./script/task/run.sh -tiup-dm --yes destroy $name - # test dm log dir tiup-dm notfound-command 2>&1 | grep $HOME/.tiup/logs/tiup-dm-debug TIUP_LOG_PATH=/tmp/a/b tiup-dm notfound-command 2>&1 | grep /tmp/a/b/tiup-dm-debug + +cp "~/.tiup/storage/dm/clusters/$name/ssh/id_rsa" "/tmp/$name.id_rsa" +tiup-dm --yes destroy $name + +# after destroy the cluster, the public key should be deleted +! ssh -i "/tmp/$name.id_rsa" tidb@$ipprefix.102 "ls" +unlink "/tmp/$name.id_rsa"