|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2024 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +# Very Simple Script for testing the demo |
| 18 | + |
| 19 | +kubectl create -f demo/gpu-test1.yaml |
| 20 | +kubectl create -f demo/gpu-test2.yaml |
| 21 | +kubectl create -f demo/gpu-test3.yaml |
| 22 | +kubectl create -f demo/gpu-test4.yaml |
| 23 | +kubectl create -f demo/gpu-test5.yaml |
| 24 | + |
| 25 | +kubectl wait --for=condition=Ready -n gpu-test1 pod/pod0 --timeout=120s |
| 26 | +kubectl wait --for=condition=Ready -n gpu-test1 pod/pod1 --timeout=120s |
| 27 | +gpu_test_1=$(kubectl get pods -n gpu-test1 | grep -c 'Running') |
| 28 | +if [ $gpu_test_1 != 2 ]; then |
| 29 | + echo "gpu_test_1 $gpu_test_1 failed to match against 2 expected pods" |
| 30 | + exit 1 |
| 31 | +fi |
| 32 | + |
| 33 | + |
| 34 | +kubectl wait --for=condition=Ready -n gpu-test2 pod/pod0 --timeout=120s |
| 35 | +gpu_test_2=$(kubectl get pods -n gpu-test2 | grep -c 'Running') |
| 36 | +if [ $gpu_test_2 != 1 ]; then |
| 37 | + echo "gpu_test_2 $gpu_test_2 failed to match against 1 expected pod" |
| 38 | + exit 1 |
| 39 | +fi |
| 40 | + |
| 41 | +kubectl wait --for=condition=Ready -n gpu-test3 pod/pod0 --timeout=120s |
| 42 | +gpu_test_3=$(kubectl get pods -n gpu-test3 | grep -c 'Running') |
| 43 | +if [ $gpu_test_3 != 1 ]; then |
| 44 | + echo "gpu_test_3 $gpu_test_3 failed to match against 1 expected pod" |
| 45 | + exit 1 |
| 46 | +fi |
| 47 | + |
| 48 | +kubectl wait --for=condition=Ready -n gpu-test4 pod/pod0 --timeout=120s |
| 49 | +kubectl wait --for=condition=Ready -n gpu-test4 pod/pod1 --timeout=120s |
| 50 | +gpu_test_4=$(kubectl get pods -n gpu-test4 | grep -c 'Running') |
| 51 | +if [ $gpu_test_4 != 2 ]; then |
| 52 | + echo "gpu_test_4 $gpu_test_4 failed to match against 1 expected pods" |
| 53 | + exit 1 |
| 54 | +fi |
| 55 | + |
| 56 | +kubectl wait --for=condition=Ready -n gpu-test5 pod/pod0 --timeout=120s |
| 57 | +gpu_test_5=$(kubectl get pods -n gpu-test5 | grep -c 'Running') |
| 58 | +if [ $gpu_test_5 != 1 ]; then |
| 59 | + echo "gpu_test_5 $gpu_test_5 failed to match against 1 expected pod" |
| 60 | + exit 1 |
| 61 | +fi |
| 62 | + |
| 63 | +echo "test ran successfully" |
0 commit comments