Skip to content

Commit 52bf1d2

Browse files
committed
Move wait for pods to be started to start-k8s script
1 parent 582ca89 commit 52bf1d2

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

start-k8s.sh

+24
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,30 @@ no_of_workers="${NO_OF_WORKERS}" \
118118
enable_nmon="${ENABLE_NMON}" \
119119
envsubst <"./k8s/master-deployment.yaml" | kubectl apply -f -
120120

121+
# Wait till all pods are running
122+
cur_timestamp="$(date +%s)"
123+
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
124+
while true; do
125+
if [ "$(date +%s)" -gt "$end_timestamp" ]; then
126+
echo "Pods are not running"
127+
exit 1
128+
fi
129+
130+
set +e
131+
pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')"
132+
set -e
133+
if [ -z "$pods_status" ]; then
134+
echo "All pods are running"
135+
break
136+
fi
137+
138+
echo "----------------------------------------"
139+
echo "Waiting for pods to be running"
140+
echo "----------------------------------------"
141+
echo "$pods_status"
142+
sleep 5
143+
done
144+
121145
# wait until master starts listening
122146
cur_timestamp="$(date +%s)"
123147
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"

test-k8s.sh

-28
Original file line numberDiff line numberDiff line change
@@ -69,34 +69,6 @@ cp -r env_init env
6969
cd "$PROJECT_ROOT"
7070
build_and_run_on_k8s
7171

72-
# Wait till all pods are running
73-
cur_timestamp="$(date +%s)"
74-
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"
75-
while true; do
76-
if [ "$(date +%s)" -gt "$end_timestamp" ]; then
77-
echo "Pods are not running"
78-
echo "Build log:"
79-
cat "$BUILD_LOG"
80-
echo "Run log:"
81-
cat "$RUN_LOG"
82-
force_remove "${TEST_ROOT}/env"
83-
clear_resources
84-
exit 1
85-
fi
86-
87-
set +e
88-
pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')"
89-
set -e
90-
if [ -z "$pods_status" ]; then
91-
echo "All pods are running"
92-
break
93-
fi
94-
95-
echo "Waiting for pods to be running"
96-
echo "$pods_status"
97-
sleep 5
98-
done
99-
10072
# Wait till JasmineGraph server start listening
10173
cur_timestamp="$(date +%s)"
10274
end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"

0 commit comments

Comments
 (0)