Skip to content

Commit

Permalink
Merge pull request kubeedge#5783 from bzsuni/bz/e2e/node-conformance
Browse files Browse the repository at this point in the history
Add nodeconformance test
  • Loading branch information
kubeedge-bot authored Sep 19, 2024
2 parents f155a8e + 4309333 commit 486b978
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,13 @@ jobs:
needs: image-prepare
env:
GO111MODULE: on
strategy:
matrix:
cases:
- conformance-type: "conformance"
result-name: "conformance-test-results"
- conformance-type: "nodeconformance"
result-name: "nodeconformance-test-results"
steps:
- name: Install Go
uses: actions/setup-go@v4
Expand Down Expand Up @@ -442,11 +449,12 @@ jobs:
- name: Run conformance e2e
run: |
export KIND_IMAGE=kindest/node:v1.29.2
export CONFORMANCE_TYPE=${{ matrix.cases.conformance-type }}
make conformance_e2e
- name: Upload conformance e2e test results
uses: actions/upload-artifact@v4
if: always()
with:
name: kube-conformance-e2e-results
name: ${{ matrix.cases.result-name }}
path: /tmp/results/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -481,5 +481,5 @@ conformance_e2e:
@echo "$$CONFORMANCE_E2E_HELP_INFO"
else
conformance_e2e:
tests/scripts/conformance_e2e.sh ${KIND_IMAGE}
tests/scripts/conformance_e2e.sh ${KIND_IMAGE} ${CONFORMANCE_TYPE}
endif
5 changes: 5 additions & 0 deletions build/conformance/node-e2e-runner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
)

const (
parallelEnvKey = "E2E_PARALLEL"
dryRunEnvKey = "E2E_DRYRUN"
skipEnvKey = "E2E_SKIP"
focusEnvKey = "E2E_FOCUS"
Expand Down Expand Up @@ -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),
Expand Down
31 changes: 24 additions & 7 deletions tests/scripts/conformance_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ KUBEEDGE_ROOT=$PWD
TEST_DIR=$(realpath $(dirname $0)/..)

GOPATH=${GOPATH:-$(go env GOPATH)}
KIND_IMAGE=${1:-"kindest/node:v1.28.0"}
KIND_IMAGE=${1:-"kindest/node:v1.29.2"}
CONFORMANCE_TYPE=${2:-"nodeconformance"}
VERSION=$(git rev-parse --short=12 HEAD)

function cleanup() {
Expand Down Expand Up @@ -68,10 +69,7 @@ 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 .
local image=$1

docker run --rm \
--env E2E_SKIP="\[Serial\]" \
Expand All @@ -83,7 +81,26 @@ function run_conformance_test() {
--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"
--network host $image
}

run_conformance_test "kubeedge/conformance-test" ${VERSION} || { echo "Conformance test failed with exit code $?"; exit 1; }
case $CONFORMANCE_TYPE in
"nodeconformance")
echo "Running nodeconformance test"
image="kubeedge/nodeconformance-test:${VERSION}"
docker build -t "$image" -f ${KUBEEDGE_ROOT}/build/conformance/nodeconformance.Dockerfile .

run_conformance_test "$image" || { echo "Node conformance test failed with exit code $?"; exit 1; }
;;
"conformance")
echo "Running conformance test"
image="kubeedge/conformance-test:${VERSION}"
docker build -t "$image" -f ${KUBEEDGE_ROOT}/build/conformance/Dockerfile .

run_conformance_test "$image" || { echo "Conformance test failed with exit code $?"; exit 1; }
;;
*)
echo "Invalid conformance type: $CONFORMANCE_TYPE"
exit 1
;;
esac

0 comments on commit 486b978

Please sign in to comment.