Skip to content

Commit

Permalink
Merge pull request kubeedge#5756 from NishantBansal2003/optimize/kead…
Browse files Browse the repository at this point in the history
…m_e2e_test

Optimize keadm E2E test kubeedge#5266
  • Loading branch information
kubeedge-bot authored Jul 29, 2024
2 parents f4471e1 + 0958ba6 commit 8a5e536
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 95 deletions.
56 changes: 56 additions & 0 deletions tests/scripts/keadm_common_e2e.sh
Original file line number Diff line number Diff line change
@@ -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
}
42 changes: 1 addition & 41 deletions tests/scripts/keadm_compatibility_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
16 changes: 2 additions & 14 deletions tests/scripts/keadm_deprecated_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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="$@"

Expand Down
41 changes: 1 addition & 40 deletions tests/scripts/keadm_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8a5e536

Please sign in to comment.