From 05b0032bd101f87a06d3d042c731f2690ffe50a1 Mon Sep 17 00:00:00 2001 From: Shinae Woo Date: Mon, 20 May 2024 13:58:16 -0700 Subject: [PATCH] Create a test script for k8s and use if from GitAction workflow Signed-off-by: Shinae Woo --- .github/workflows/go.yml | 25 ++----------------------- tests/ci/test_k8s.sh | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 23 deletions(-) create mode 100755 tests/ci/test_k8s.sh diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7a67c15..6842a1c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -85,30 +85,9 @@ jobs: - name: Build run: make build - - name: Set up Helm - uses: azure/setup-helm@v4.2.0 - with: - version: v3.14.4 - - name: Create k8s Kind Cluster uses: helm/kind-action@v1 - - name: Install KWOK node simulator - run: | - kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml" - kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml" - kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-init-container-running-failed.yaml - kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-container-running-failed.yaml - kubectl apply -f charts/overrides/kwok/pod-complete.yml - - - name: Add virtual nodes to the cluster - run: | - helm install virtual-nodes charts/virtual-nodes -f charts/virtual-nodes/values-example.yaml - kubectl get nodes - - - name: Run knavigator with an example test + - name: Run test scripts run: | - kubectl create ns k8s-test - kubectl create priorityclass normal-priority --value=100000 - ./bin/knavigator -tasks resources/tests/k8s/test-job.yml - kubectl get job -n k8s-test + ./tests/ci/test_k8s.sh \ No newline at end of file diff --git a/tests/ci/test_k8s.sh b/tests/ci/test_k8s.sh new file mode 100755 index 0000000..a3c5ce6 --- /dev/null +++ b/tests/ci/test_k8s.sh @@ -0,0 +1,16 @@ +#! /bin/bash -x + +REPO_HOME=$(readlink -f $(dirname $(readlink -f "$0"))/../../../) + +# Install KWOK node simulator +KWOK_REPO=kubernetes-sigs/kwok +KWOK_LATEST_RELEASE=v0.5.2 + +kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml" +kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml" +kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-init-container-running-failed.yaml +kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-container-running-failed.yaml +kubectl apply -f ${REPO_HOME}/charts/overrides/kwok/pod-complete.yml + +# Run knavigator with an example test +${REPO_HOME}/bin/knavigator -tasks ${REPO_HOME}/resources/tests/k8s/test-job.yml