summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishant Bansal <nishant.bansal.mec21@iitbhu.ac.in>2024-07-26 18:46:14 +0530
committerNishant Bansal <nishant.bansal.mec21@iitbhu.ac.in>2024-07-26 18:50:54 +0530
commit0958ba6cec778123655cf0fc1be4f2bbd90a3507 (patch)
treef01609c1b8ae279d43288a074fbb3472cb58be10
parentMerge pull request #5653 from Shelley-BaoYue/go1.21 (diff)
downloadkubeedge-0958ba6cec778123655cf0fc1be4f2bbd90a3507.tar.gz
Optimize keadm E2E test #5266
Signed-off-by: Nishant Bansal <nishant.bansal.mec21@iitbhu.ac.in>
-rw-r--r--tests/scripts/keadm_common_e2e.sh56
-rwxr-xr-xtests/scripts/keadm_compatibility_e2e.sh42
-rwxr-xr-xtests/scripts/keadm_deprecated_e2e.sh16
-rwxr-xr-xtests/scripts/keadm_e2e.sh41
4 files changed, 60 insertions, 95 deletions
diff --git a/tests/scripts/keadm_common_e2e.sh b/tests/scripts/keadm_common_e2e.sh
new file mode 100644
index 000000000..1a45d8717
--- /dev/null
+++ b/tests/scripts/keadm_common_e2e.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# Copyright 2024 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.
+
+KUBEEDGE_ROOT=$PWD
+E2E_DIR=$(realpath $(dirname $0)/..)
+
+function build_ginkgo() {
+ cd $E2E_DIR
+ ginkgo build -r e2e_keadm/
+}
+
+function prepare_cluster() {
+ kind create cluster --name test
+
+ echo "wait the control-plane ready..."
+ kubectl wait --for=condition=Ready node/test-control-plane --timeout=60s
+
+ kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
+
+ # edge side don't support kind cni now, delete kind cni plugin for workaround
+ kubectl delete daemonset kindnet -nkube-system
+}
+
+function run_test() {
+ :> /tmp/testcase.log
+ cd $E2E_DIR
+
+ export ACK_GINKGO_RC=true
+
+ ginkgo -v ./e2e_keadm/e2e_keadm.test -- \
+ --image-url=nginx \
+ --image-url=nginx \
+ --kube-master="https://$MASTER_IP:6443" \
+ --kubeconfig=$KUBECONFIG \
+ --test.v
+ if [[ $? != 0 ]]; then
+ echo "Integration suite has failures, Please check !!"
+ exit 1
+ else
+ echo "Integration suite successfully passed all the tests !!"
+ exit 0
+ fi
+} \ No newline at end of file
diff --git a/tests/scripts/keadm_compatibility_e2e.sh b/tests/scripts/keadm_compatibility_e2e.sh
index ca1f77ee7..048c9df73 100755
--- a/tests/scripts/keadm_compatibility_e2e.sh
+++ b/tests/scripts/keadm_compatibility_e2e.sh
@@ -15,13 +15,11 @@
# limitations under the License.
KUBEEDGE_ROOT=$PWD
-WORKDIR=$(dirname $0)
-E2E_DIR=$(realpath $(dirname $0)/..)
IMAGE_TAG=$(git describe --tags)
CLOUD_EDGE_VERSION=${1:-"v1.15.1"}
-
source "${KUBEEDGE_ROOT}/hack/lib/install.sh"
+source "${KUBEEDGE_ROOT}/tests/scripts/keadm_common_e2e.sh"
function cleanup() {
sudo pkill edgecore || true
@@ -30,23 +28,6 @@ function cleanup() {
sudo rm -rf /var/log/kubeedge /etc/kubeedge /etc/systemd/system/edgecore.service $E2E_DIR/e2e_keadm/e2e_keadm.test $E2E_DIR/config.json
}
-function build_ginkgo() {
- cd $E2E_DIR
- ginkgo build -r e2e_keadm/
-}
-
-function prepare_cluster() {
- kind create cluster --name test
-
- echo "wait the control-plane ready..."
- kubectl wait --for=condition=Ready node/test-control-plane --timeout=60s
-
- kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
-
- # edge side don't support kind cni now, delete kind cni plugin for workaround
- kubectl delete daemonset kindnet -nkube-system
-}
-
function build_image() {
cd $KUBEEDGE_ROOT
make image WHAT=installation-package -f $KUBEEDGE_ROOT/Makefile
@@ -97,27 +78,6 @@ function start_kubeedge() {
done
}
-function run_test() {
- :> /tmp/testcase.log
- cd $E2E_DIR
-
- export ACK_GINKGO_RC=true
-
- ginkgo -v ./e2e_keadm/e2e_keadm.test -- \
- --image-url=nginx \
- --image-url=nginx \
- --kube-master="https://$MASTER_IP:6443" \
- --kubeconfig=$KUBECONFIG \
- --test.v
- if [[ $? != 0 ]]; then
- echo "Integration suite has failures, Please check !!"
- exit 1
- else
- echo "Integration suite successfully passed all the tests !!"
- exit 0
- fi
-}
-
set -Ee
trap cleanup EXIT
diff --git a/tests/scripts/keadm_deprecated_e2e.sh b/tests/scripts/keadm_deprecated_e2e.sh
index 9b11c529e..80ef06bdc 100755
--- a/tests/scripts/keadm_deprecated_e2e.sh
+++ b/tests/scripts/keadm_deprecated_e2e.sh
@@ -15,11 +15,11 @@
# limitations under the License.
KUBEEDGE_ROOT=$PWD
-WORKDIR=$(dirname $0)
-E2E_DIR=$(realpath $(dirname $0)/..)
source "${KUBEEDGE_ROOT}/hack/lib/golang.sh"
source "${KUBEEDGE_ROOT}/hack/lib/install.sh"
+source "${KUBEEDGE_ROOT}/tests/scripts/keadm_common_e2e.sh"
+
kubeedge::version::get_version_info
VERSION=${GIT_VERSION}
@@ -40,18 +40,6 @@ function build_keadm() {
ginkgo build -r e2e_keadm/
}
-function prepare_cluster() {
- kind create cluster --name test
-
- echo "wait the control-plane ready..."
- kubectl wait --for=condition=Ready node/test-control-plane --timeout=60s
-
- kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
-
- # edge side don't support kind cni now, delete kind cni plugin for workaround
- kubectl delete daemonset kindnet -nkube-system
-}
-
function start_kubeedge() {
local KUBEEDGE_VERSION="$@"
diff --git a/tests/scripts/keadm_e2e.sh b/tests/scripts/keadm_e2e.sh
index c491020b9..7ec91c354 100755
--- a/tests/scripts/keadm_e2e.sh
+++ b/tests/scripts/keadm_e2e.sh
@@ -15,12 +15,11 @@
# limitations under the License.
KUBEEDGE_ROOT=$PWD
-WORKDIR=$(dirname $0)
-E2E_DIR=$(realpath $(dirname $0)/..)
IMAGE_TAG=$(git describe --tags)
KUBEEDGE_VERSION=$IMAGE_TAG
source "${KUBEEDGE_ROOT}/hack/lib/install.sh"
+source "${KUBEEDGE_ROOT}/tests/scripts/keadm_common_e2e.sh"
function cleanup() {
sudo pkill edgecore || true
@@ -32,23 +31,6 @@ function cleanup() {
sudo rm -rf /var/log/kubeedge /etc/kubeedge /etc/systemd/system/edgecore.service $E2E_DIR/e2e_keadm/e2e_keadm.test $E2E_DIR/config.json
}
-function build_ginkgo() {
- cd $E2E_DIR
- ginkgo build -r e2e_keadm/
-}
-
-function prepare_cluster() {
- kind create cluster --name test
-
- echo "wait the control-plane ready..."
- kubectl wait --for=condition=Ready node/test-control-plane --timeout=60s
-
- kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin --user=system:anonymous
-
- # edge side don't support kind cni now, delete kind cni plugin for workaround
- kubectl delete daemonset kindnet -nkube-system
-}
-
function build_image() {
cd $KUBEEDGE_ROOT
make image WHAT=cloudcore -f $KUBEEDGE_ROOT/Makefile
@@ -95,27 +77,6 @@ function start_kubeedge() {
done
}
-function run_test() {
- :> /tmp/testcase.log
- cd $E2E_DIR
-
- export ACK_GINKGO_RC=true
-
- ginkgo -v ./e2e_keadm/e2e_keadm.test -- \
- --image-url=nginx \
- --image-url=nginx \
- --kube-master="https://$MASTER_IP:6443" \
- --kubeconfig=$KUBECONFIG \
- --test.v
- if [[ $? != 0 ]]; then
- echo "Integration suite has failures, Please check !!"
- exit 1
- else
- echo "Integration suite successfully passed all the tests !!"
- exit 0
- fi
-}
-
set -Ee
trap cleanup EXIT
#trap cleanup ERR