summaryrefslogtreecommitdiff
path: root/tests/scripts/execute.sh
blob: f1e075a23b299ef18c259651203067cf52168273 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash

# Copyright 2019 The KubeEdge Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

workdir=$(pwd)
cd $workdir

curpath=$PWD
echo $PWD

GOPATH=${GOPATH:-$(go env GOPATH)}
KIND_IMAGE=${1:-"kindest/node:v1.26.0"}
compilemodule=$2

which ginkgo &>/dev/null || (
  go install github.com/onsi/ginkgo/v2/ginkgo@latest
  sudo cp $GOPATH/bin/ginkgo /usr/local/bin/
)

cleanup() {
  bash ${curpath}/tests/scripts/cleanup.sh
}

cleanup

sudo rm -rf ${curpath}/tests/e2e/e2e.test
sudo rm -rf ${curpath}/tests/e2e_keadm/e2e_keadm.test

# Specify the module name to compile in below command
bash -x ${curpath}/tests/scripts/compile.sh ${compilemodule}

ENABLE_DAEMON=true bash -x ${curpath}/hack/local-up-kubeedge.sh ${KIND_IMAGE} || {
  echo "failed to start cluster !!!"
  exit 1
}

: >/tmp/testcase.log

export GINKGO_TESTING_RESULT=0

trap cleanup EXIT

bash -x ${curpath}/tests/scripts/fast_test.sh ${compilemodule}