Skip to content

Commit c9f0cb9

Browse files
authored
Improve nsc test order (#1710)
1 parent d84bd08 commit c9f0cb9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.github/workflows/scripts/ns_cluster_tests.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,37 @@ tmux send-keys -t NsSSHSession "exit" Enter
4949
# Spawn an nginx pod to generate application logs.
5050
$NSC_BIN kubectl $CLUSTER_ID run nginx --image=nginx --restart=Never
5151

52-
# Test ns cluster logs
52+
# Test nsc kubectl get pods -A
5353
s=1
54-
for i in $(seq 1 20); do
55-
LOGS=$($NSC_BIN logs $CLUSTER_ID --all | wc -l)
56-
if [[ $(($LOGS)) -gt 10 ]]; then
57-
echo "Found cluster logs!"
54+
for i in $(seq 1 5); do
55+
K_OUT=$($NSC_BIN kubectl $CLUSTER_ID get pods -A | wc -l)
56+
if [[ $(($K_OUT)) -gt 0 ]]; then
57+
echo "Found K8s pods!"
5858
s=0
5959
break
6060
fi
61-
echo "Still no logs from cluster... (attempt $i, got $LOGS lines)"
61+
echo "Still no pods from cluster..."
6262
sleep 5
6363
done
6464
if [[ $s -gt 0 ]]; then
65-
echo "FAILED: no logs from $CLUSTER_ID."
65+
echo "FAILED: no Kubernetes pods running on $CLUSTER_ID."
6666
exit 1
6767
fi
6868

69-
# Test nsc kubectl get pods -A
69+
# Test ns cluster logs
7070
s=1
71-
for i in $(seq 1 5); do
72-
K_OUT=$($NSC_BIN kubectl $CLUSTER_ID get pods -A | wc -l)
73-
if [[ $(($K_OUT)) -gt 0 ]]; then
74-
echo "Found K8s pods!"
71+
for i in $(seq 1 10); do
72+
LOGS=$($NSC_BIN logs $CLUSTER_ID | wc -l)
73+
if [[ $(($LOGS)) -gt 0 ]]; then
74+
echo "Found cluster logs!"
7575
s=0
7676
break
7777
fi
78-
echo "Still no pods from cluster..."
78+
echo "Still no logs from cluster..."
7979
sleep 5
8080
done
8181
if [[ $s -gt 0 ]]; then
82-
echo "FAILED: no Kubernetes pods running on $CLUSTER_ID."
82+
echo "FAILED: no logs from $CLUSTER_ID."
8383
exit 1
8484
fi
8585

0 commit comments

Comments
 (0)