github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/tests/e2e/scripts/execute.sh (about)

     1  #!/bin/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  workdir=`pwd`
    18  cd $workdir
    19  
    20  curpath=$PWD
    21  echo $PWD
    22  
    23  go get github.com/onsi/ginkgo/ginkgo
    24  sudo cp $GOPATH/bin/ginkgo /usr/bin/
    25  
    26  bash ${curpath}/tests/e2e/scripts/cleanup.sh deployment
    27  bash ${curpath}/tests/e2e/scripts/cleanup.sh edgesite
    28  bash ${curpath}/tests/e2e/scripts/cleanup.sh device_crd
    29  
    30  #builds kubeedge components binary
    31  make
    32  
    33  sleep 2s
    34  
    35  E2E_DIR=${curpath}/tests/e2e
    36  sudo rm -rf ${E2E_DIR}/deployment/deployment.test
    37  sudo rm -rf ${E2E_DIR}/device_crd/device_crd.test
    38  
    39  # Specify the module name to compile in below command
    40  bash -x ${E2E_DIR}/scripts/compile.sh $1
    41  
    42  kind create cluster --name test
    43  
    44  kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
    45  
    46  kubectl create -f ${curpath}/build/crds/reliablesyncs/cluster_objectsync_v1alpha1.yaml
    47  kubectl create -f ${curpath}/build/crds/reliablesyncs/objectsync_v1alpha1.yaml
    48  kubectl create -f ${curpath}/build/crds/devices/devices_v1alpha1_device.yaml
    49  kubectl create -f ${curpath}/build/crds/devices/devices_v1alpha1_devicemodel.yaml
    50  
    51  # edge side don't support kind cni now, delete kind cni plugin for workaround
    52  kubectl delete daemonset kindnet -nkube-system
    53  
    54  :> /tmp/testcase.log
    55  
    56  bash -x ${E2E_DIR}/scripts/fast_test.sh $1
    57  
    58  #stop the edgecore after the test completion
    59  grep  -e "Running Suite" -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | sed -r 's/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g'
    60  echo "Integration Test Final Summary Report"
    61  echo "==============================================="
    62  echo "Total Number of Test cases = `grep "Ran " /tmp/testcase.log | awk '{sum+=$2} END {print sum}'`"
    63  passed=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $3}' | sed -r "s/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'`
    64  echo "Number of Test cases PASSED = $passed"
    65  fail=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $6}' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'`
    66  echo "Number of Test cases FAILED = $fail"
    67  echo "==================Result Summary======================="
    68  
    69  if [ "$fail" != "0" ];then
    70      echo "Integration suite has failures, Please check !!"
    71      exit 1
    72  else
    73      echo "Integration suite successfully passed all the tests !!"
    74      exit 0
    75  fi