Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify environment variables in e2e test #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion test/e2e/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,26 @@ kubectl create -f demo/gpu-test3.yaml
kubectl create -f demo/gpu-test4.yaml
kubectl create -f demo/gpu-test5.yaml

function verify-env {
local namespace="$1"
local pod="$2"
for ctr in $(kubectl get pod -n "$namespace" "$pod" -o jsonpath='{.spec.containers[*].name}'); do
if ! kubectl logs -n "$namespace" "$pod" -c "$ctr" | grep -q "GPU_DEVICE_"; then
echo "Pod $namespace/$pod, container $ctr missing GPU_DEVICE_ environment variables"
exit 1
fi
done
}

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
verify-env gpu-test1 pod0
verify-env gpu-test1 pod1


kubectl wait --for=condition=Ready -n gpu-test2 pod/pod0 --timeout=120s
Expand All @@ -42,28 +55,33 @@ if [ $gpu_test_2 != 1 ]; then
echo "gpu_test_2 $gpu_test_2 failed to match against 1 expected pod"
exit 1
fi
verify-env gpu-test2 pod0

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
verify-env gpu-test3 pod0

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"
echo "gpu_test_4 $gpu_test_4 failed to match against 2 expected pods"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I did sneak in this typo fix also.

exit 1
fi
verify-env gpu-test4 pod0
verify-env gpu-test4 pod1

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
verify-env gpu-test5 pod0

# test that deletion is fast (less than the default grace period of 30s)
# see https://github.com/kubernetes/kubernetes/issues/127188 for details
Expand Down
Loading