generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from kannon92/setup-e2e-test-github-action
E2E Test
- Loading branch information
Showing
5 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run tests | ||
|
||
on: [ push, pull_request ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.22.6 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Build | ||
run: make PREFIX=artifacts cmds | ||
- name: install helm and kubectl | ||
run: | | ||
sudo snap install helm --classic | ||
sudo snap install kubectl --classic | ||
- name: Setup e2e | ||
run: make setup-e2e | ||
- name: run e2e test | ||
run: make test-e2e | ||
- name: teardown e2e test | ||
run: make teardown-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2024 The Kubernetes 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. | ||
|
||
# Very Simple Script for testing the demo | ||
|
||
kubectl create -f demo/gpu-test1.yaml | ||
kubectl create -f demo/gpu-test2.yaml | ||
kubectl create -f demo/gpu-test3.yaml | ||
kubectl create -f demo/gpu-test4.yaml | ||
kubectl create -f demo/gpu-test5.yaml | ||
|
||
kubectl wait --for=condition=Ready -n gpu-test1 pod/pod0 --timeout=120s | ||
kubectl wait --for=condition=Ready -n gpu-test1 pod/pod1 --timeout=120s | ||
gpu_test_1=$(kubectl get pods -n gpu-test1 | grep -c 'Running') | ||
if [ $gpu_test_1 != 2 ]; then | ||
echo "gpu_test_1 $gpu_test_1 failed to match against 2 expected pods" | ||
exit 1 | ||
fi | ||
|
||
|
||
kubectl wait --for=condition=Ready -n gpu-test2 pod/pod0 --timeout=120s | ||
gpu_test_2=$(kubectl get pods -n gpu-test2 | grep -c 'Running') | ||
if [ $gpu_test_2 != 1 ]; then | ||
echo "gpu_test_2 $gpu_test_2 failed to match against 1 expected pod" | ||
exit 1 | ||
fi | ||
|
||
kubectl wait --for=condition=Ready -n gpu-test3 pod/pod0 --timeout=120s | ||
gpu_test_3=$(kubectl get pods -n gpu-test3 | grep -c 'Running') | ||
if [ $gpu_test_3 != 1 ]; then | ||
echo "gpu_test_3 $gpu_test_3 failed to match against 1 expected pod" | ||
exit 1 | ||
fi | ||
|
||
kubectl wait --for=condition=Ready -n gpu-test4 pod/pod0 --timeout=120s | ||
kubectl wait --for=condition=Ready -n gpu-test4 pod/pod1 --timeout=120s | ||
gpu_test_4=$(kubectl get pods -n gpu-test4 | grep -c 'Running') | ||
if [ $gpu_test_4 != 2 ]; then | ||
echo "gpu_test_4 $gpu_test_4 failed to match against 1 expected pods" | ||
exit 1 | ||
fi | ||
|
||
kubectl wait --for=condition=Ready -n gpu-test5 pod/pod0 --timeout=120s | ||
gpu_test_5=$(kubectl get pods -n gpu-test5 | grep -c 'Running') | ||
if [ $gpu_test_5 != 1 ]; then | ||
echo "gpu_test_5 $gpu_test_5 failed to match against 1 expected pod" | ||
exit 1 | ||
fi | ||
|
||
echo "test ran successfully" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2024 The Kubernetes 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. | ||
# | ||
# stop at first failure to save time | ||
set -e | ||
|
||
bash demo/build-driver.sh | ||
bash demo/create-cluster.sh | ||
helm upgrade -i \ | ||
--create-namespace \ | ||
--namespace dra-example-driver \ | ||
dra-example-driver \ | ||
deployments/helm/dra-example-driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Kubernetes 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. | ||
|
||
# This scripts invokes `kind build image` so that the resulting | ||
# image has a containerd with CDI support. | ||
# | ||
# Usage: kind-build-image.sh <tag of generated image> | ||
|
||
set -e | ||
|
||
bash demo/delete-cluster.sh |