Skip to content

Commit 415671d

Browse files
kate-goldenringMossaka
authored andcommitted
Amend kubectl wait statements
Signed-off-by: Kate Goldenring <[email protected]>
1 parent a2433e2 commit 415671d

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

node-installer/tests/integration-test-k3s.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ echo "Applying KWasm node installer job..."
5151
kubectl apply -f ./k3s-kwasm-job.yml
5252

5353
echo "Waiting for node installer job to complete..."
54-
kubectl wait -n kwasm --for=jsonpath='{.status.phase}'=Succeeded pod --selector=job-name=k3s-provision-kwasm --timeout=60s
54+
if ! kubectl wait -n kwasm --for=jsonpath='{.status.phase}'=Succeeded pod --selector=job-name=k3s-provision-kwasm --timeout=60s; then
55+
echo "Node installer job failed!"
56+
kubectl describe pod -n kwasm
57+
exit 1
58+
fi
5559

5660
# Verify the SystemdCgroup is set to true
5761
if sudo cat /var/lib/rancher/k3s/agent/etc/containerd/config.toml | grep -A2 "runtimes.spin.options" | grep -q "SystemdCgroup = true"; then
@@ -72,7 +76,11 @@ sudo k3s ctr images pull ghcr.io/spinkube/containerd-shim-spin/examples/spin-rus
7276
kubectl apply -f ./tests/workloads/workload.yaml
7377

7478
echo "Waiting for deployment to be ready..."
75-
kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s
79+
if ! kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s; then
80+
echo "Deployment failed to become ready!"
81+
kubectl describe deployment wasm-spin
82+
exit 1
83+
fi
7684

7785
echo "Checking pod status..."
7886
kubectl get pods

node-installer/tests/integration-test-microk8s.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ echo "=== Step 4: Apply the workload ==="
8080
kubectl apply -f ./tests/workloads/workload.yaml
8181

8282
echo "Waiting for deployment to be ready..."
83-
if kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s; then
83+
if ! kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s; then
8484
echo "Deployment failed to become ready!"
8585
kubectl describe deployment wasm-spin
8686
exit 1

node-installer/tests/integration-test-minikube.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ sed -i "s/spin-test-control-plane/${NODE_NAME}/g" minikube-kwasm-job.yml
4040
echo "Applying KWasm node installer job..."
4141
kubectl apply -f ./minikube-kwasm-job.yml
4242

43-
echo "Waiting for node installer job to complete..."
4443
kubectl wait -n kwasm --for=condition=Ready pod --selector=job-name=minikube-provision-kwasm --timeout=90s || true
45-
kubectl wait -n kwasm --for=jsonpath='{.status.phase}'=Succeeded pod --selector=job-name=minikube-provision-kwasm --timeout=60s
44+
echo "Waiting for node installer job to complete..."
45+
if ! kubectl wait -n kwasm --for=jsonpath='{.status.phase}'=Succeeded pod --selector=job-name=minikube-provision-kwasm --timeout=60s; then
46+
echo "Node installer job failed!"
47+
kubectl describe pod -n kwasm
48+
exit 1
49+
fi
4650

4751
# Verify the SystemdCgroup is set to true
4852
if docker exec $NODE_NAME cat /etc/containerd/config.toml | grep -A5 "spin" | grep -q "SystemdCgroup = true"; then
@@ -62,7 +66,11 @@ echo "=== Step 4: Apply the workload ==="
6266
kubectl apply -f ./tests/workloads/workload.yaml
6367

6468
echo "Waiting for deployment to be ready..."
65-
kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s
69+
if ! kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s; then
70+
echo "Deployment failed to become ready!"
71+
kubectl describe po wasm-spin
72+
exit 1
73+
fi
6674

6775
echo "Checking pod status..."
6876
kubectl get pods

0 commit comments

Comments
 (0)