summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yaml54
-rw-r--r--Makefile17
-rw-r--r--build/conformance/e2e-runner/run.go5
-rw-r--r--build/conformance/kubernetes/edge_skip_case.yaml1
-rwxr-xr-xtests/scripts/conformance_e2e.sh89
5 files changed, 165 insertions, 1 deletions
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 7931451bd..1b5feaec0 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -391,4 +391,56 @@ jobs:
name: ${{ matrix.container-runtime }}-e2e-test-logs
path: |
/tmp/cloudcore.log
- /tmp/edgecore.log \ No newline at end of file
+ /tmp/edgecore.log
+
+ conformance_e2e_test:
+ runs-on: ubuntu-22.04
+ timeout-minutes: 40
+ name: conformance e2e test
+ needs: image-prepare
+ env:
+ GO111MODULE: on
+ steps:
+ - name: Install Go
+ uses: actions/setup-go@v3
+ with:
+ go-version: 1.21.x
+
+ - uses: actions/cache@v3
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+
+ - name: Checkout code
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Cleanup images
+ run: docker system prune -a -f
+
+ - name: Retrieve saved kubeedge/build-tools image
+ uses: actions/download-artifact@v3
+ with:
+ name: build-tools-docker-artifact
+ path: /home/runner/build-tools
+
+ - name: Docker load kubeedge/build-tools image
+ run: |
+ docker load < /home/runner/build-tools/build-tools.tar
+
+ - name: Enable cri config in containerd service
+ run: |
+ containerd config default | sudo tee /etc/containerd/config.toml && sudo systemctl restart containerd.service
+
+ - name: Run conformance e2e
+ run: |
+ export KIND_IMAGE=kindest/node:v1.28.0
+ make conformance_e2e
+
+ - name: Upload conformance e2e test results
+ uses: actions/upload-artifact@v3
+ if: always()
+ with:
+ name: kube-conformance-e2e-results
+ path: /tmp/results/ \ No newline at end of file
diff --git a/Makefile b/Makefile
index 548a93fe6..3cc9605b5 100644
--- a/Makefile
+++ b/Makefile
@@ -466,3 +466,20 @@ else
keadm_compatibility_e2e:
tests/scripts/keadm_compatibility_e2e.sh ${CLOUD_EDGE_VERSION}
endif
+
+define CONFORMANCE_E2E_HELP_INFO
+# conformance_e2e test.
+#
+# Example:
+# make conformance_e2e
+# make conformance_e2e HELP=y
+#
+endef
+.PHONY: conformance_e2e
+ifeq ($(HELP),y)
+conformance_e2e:
+ @echo "$$CONFORMANCE_E2E_HELP_INFO"
+else
+conformance_e2e:
+ tests/scripts/conformance_e2e.sh ${KIND_IMAGE}
+endif \ No newline at end of file
diff --git a/build/conformance/e2e-runner/run.go b/build/conformance/e2e-runner/run.go
index 75018c960..613ced340 100644
--- a/build/conformance/e2e-runner/run.go
+++ b/build/conformance/e2e-runner/run.go
@@ -33,6 +33,7 @@ import (
)
const (
+ parallelEnvKey = "E2E_PARALLEL"
dryRunEnvKey = "E2E_DRYRUN"
skipEnvKey = "E2E_SKIP"
focusEnvKey = "E2E_FOCUS"
@@ -139,6 +140,10 @@ func makeCmd(w io.Writer) (*exec.Cmd, error) {
ginkgoArgs = append(ginkgoArgs, "--dryRun=true")
}
+ if parallelEnvValue := util.GetEnvWithDefault(parallelEnvKey, ""); len(parallelEnvValue) > 0 {
+ ginkgoArgs = append(ginkgoArgs, parallelEnvValue)
+ }
+
extraArgs := []string{
"--report-dir=" + util.GetEnvWithDefault(resultsDirEnvKey, defaultResultsDir),
"--report-prefix=" + util.GetEnvWithDefault(reportPrefixEnvKey, defaultReportPrefix),
diff --git a/build/conformance/kubernetes/edge_skip_case.yaml b/build/conformance/kubernetes/edge_skip_case.yaml
index b3cacec5b..7464bd926 100644
--- a/build/conformance/kubernetes/edge_skip_case.yaml
+++ b/build/conformance/kubernetes/edge_skip_case.yaml
@@ -20,3 +20,4 @@
- codename: Should recreate evicted statefulset
- codename: should execute poststart exec hook properly
- codename: should execute prestop exec hook properly
+- codename: should not cause race condition when used for configmaps \ No newline at end of file
diff --git a/tests/scripts/conformance_e2e.sh b/tests/scripts/conformance_e2e.sh
new file mode 100755
index 000000000..68296382d
--- /dev/null
+++ b/tests/scripts/conformance_e2e.sh
@@ -0,0 +1,89 @@
+#!/bin/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.
+
+set -e
+set -x
+
+KUBEEDGE_ROOT=$PWD
+TEST_DIR=$(realpath $(dirname $0)/..)
+
+GOPATH=${GOPATH:-$(go env GOPATH)}
+KIND_IMAGE=${1:-"kindest/node:v1.28.0"}
+VERSION=$(git rev-parse --short=12 HEAD)
+
+function cleanup() {
+ bash ${KUBEEDGE_ROOT}/tests/scripts/cleanup.sh
+}
+
+function validate_ip() {
+ local ip=$1
+ if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+cleanup
+
+ENABLE_DAEMON=true bash -x ${KUBEEDGE_ROOT}/hack/local-up-kubeedge.sh ${KIND_IMAGE} || {
+ echo "failed to start cluster !!!"
+ exit 1
+}
+
+trap cleanup EXIT
+
+sleep 10
+
+MASTER_IP=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' test-control-plane`
+if [ -z "$MASTER_IP" ] || ! validate_ip "$MASTER_IP"; then
+ echo "error when get master ip: $MASTER_IP"
+ exit 1
+fi
+
+if [ ! -f "$HOME/.kube/config" ]; then
+ echo "not found kubeconfig file"
+ exit 1
+fi
+
+export KUBECONFIG=$HOME/.kube/config
+
+if [ ! -d "/tmp/results" ]; then
+ mkdir -p /tmp/results
+fi
+
+rm -rf /tmp/results/*
+
+function run_conformance_test() {
+ local image_name=$1
+ local tag_name=$2
+
+ docker build -t "$image_name:$tag_name" -f ${KUBEEDGE_ROOT}/build/conformance/Dockerfile .
+
+ docker run --rm \
+ --env E2E_SKIP="\[Serial\]" \
+ --env E2E_PARALLEL="-p" \
+ --env CHECK_EDGECORE_ENVIRONMENT="false" \
+ --env ACK_GINKGO_RC="true" \
+ --env KUBECONFIG=/root/.kube/config \
+ --env RESULTS_DIR=/tmp/results \
+ --env E2E_EXTRA_ARGS="--kube-master=https://${MASTER_IP}:6443" \
+ -v ${KUBECONFIG}:/root/.kube/config \
+ -v /tmp/results:/tmp/results \
+ --network host "$image_name:$tag_name"
+}
+
+run_conformance_test "kubeedge/conformance-test" ${VERSION} || { echo "Conformance test failed with exit code $?"; exit 1; } \ No newline at end of file