github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/tests/e2e/scripts/cleanup.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2019 The KubeEdge 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 setuptype=$1 18 19 kill_edgecore() { 20 if pgrep edgecore >/dev/null 21 then 22 # edgecore process is found, kill the process. 23 sudo pkill edgecore 24 if [[ "$?" == "0" ]]; then 25 echo "edgecore is successfully killed !!" 26 else 27 echo "Failed to kill edgecore process !!" 28 exit 1 29 fi 30 fi 31 } 32 33 kill_cloudcore() { 34 if pgrep cloudcore >/dev/null 35 then 36 # cloudcore process is found, kill the process. 37 sudo pkill cloudcore 38 if [[ "$?" == "0" ]]; then 39 echo "cloudcore is successfully killed !!" 40 else 41 echo "Failed to kill cloudcore process !!" 42 exit 1 43 fi 44 fi 45 } 46 47 kill_edgesite() { 48 if pgrep edgesite >/dev/null 49 then 50 # edgesite process is found, kill the process. 51 sudo pkill edgesite 52 if [[ "$?" == "0" ]]; then 53 echo "edgesite is successfully killed !!" 54 else 55 echo "Failed to kill edgesite process !!" 56 exit 1 57 fi 58 fi 59 } 60 61 cleanup_files(){ 62 workdir=$GOPATH/src/github.com/kubeedge/kubeedge 63 cd $workdir 64 65 sudo rm -rf cloud/cloudcore 66 sudo rm -rf cloud/tmp/ 67 sudo rm -rf edge/edge.db 68 sudo rm -rf edge/edgecore 69 sudo rm -rf edge/tmp/ 70 sudo rm -rf tests/e2e/kubeedge.crt 71 sudo rm -rf tests/e2e/kubeedge.csr 72 sudo rm -rf tests/e2e/kubeedge.key 73 sudo rm -rf tests/e2e/rootCA.crt 74 sudo rm -rf tests/e2e/rootCA.key 75 sudo rm -rf tests/e2e/rootCA.srl 76 } 77 78 if [ "deployment" = ${setuptype} ]; then 79 kill_edgecore 80 kill_cloudcore 81 sudo rm -rf tests/e2e/deployment/deployment.test 82 fi 83 84 if [ "device_crd" = ${setuptype} ]; then 85 kill_edgecore 86 kill_cloudcore 87 sudo rm -rf tests/e2e/device_crd/device_crd.test 88 fi 89 90 if [ "edgesite" = ${setuptype} ]; then 91 kill_edgesite 92 sudo rm -rf tests/e2e/edgesite/edgesite.test 93 sudo rm -rf tests/e2e/config.json 94 95 fi 96 97 cleanup_files