mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Improve testing reliability
This commit is contained in:
parent
0ad9221f5c
commit
10e8c43f46
@ -33,17 +33,25 @@ function remove-quotes() {
|
|||||||
echo $stripped
|
echo $stripped
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function teardown() {
|
||||||
|
echo "Cleaning up test artifacts"
|
||||||
|
$CLOUDCFG stop myNginx
|
||||||
|
$CLOUDCFG rm myNginx
|
||||||
|
}
|
||||||
|
|
||||||
|
trap "teardown" EXIT
|
||||||
|
|
||||||
POD_ID_LIST=$($CLOUDCFG -json -l name=myNginx list pods | jq ".items[].id")
|
POD_ID_LIST=$($CLOUDCFG -json -l name=myNginx list pods | jq ".items[].id")
|
||||||
# Container turn up on a clean cluster can take a while for the docker image pull.
|
# Container turn up on a clean cluster can take a while for the docker image pull.
|
||||||
ALL_RUNNING=false
|
ALL_RUNNING=0
|
||||||
while [[ $ALL_RUNNING -ne "true" ]]; do
|
while [ $ALL_RUNNING -ne 1 ]; do
|
||||||
echo "Waiting for containers to come up."
|
echo "Waiting for all containers in pod to come up."
|
||||||
sleep 5
|
sleep 5
|
||||||
ALL_RUNNING=true
|
ALL_RUNNING=1
|
||||||
for id in $POD_ID_LIST; do
|
for id in $POD_ID_LIST; do
|
||||||
CURRENT_STATUS=$(remove-quotes $($CLOUDCFG -json get "pods/$(remove-quotes ${id})" | jq '.currentState.status'))
|
CURRENT_STATUS=$(remove-quotes $($CLOUDCFG -json get "pods/$(remove-quotes ${id})" | jq '.currentState.info["mynginx"].State.Running and .currentState.info["net"].State.Running'))
|
||||||
if [[ $CURRENT_STATUS -ne "Running" ]]; then
|
if [ "$CURRENT_STATUS" != "true" ]; then
|
||||||
ALL_RUNNING=false
|
ALL_RUNNING=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -51,6 +59,10 @@ done
|
|||||||
# Get minion IP addresses
|
# Get minion IP addresses
|
||||||
detect-minions
|
detect-minions
|
||||||
|
|
||||||
|
# let images stabilize
|
||||||
|
echo "Letting images stabilize"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
# Verify that something is listening (nginx should give us a 404)
|
# Verify that something is listening (nginx should give us a 404)
|
||||||
for (( i=0; i<${#KUBE_MINION_IP_ADDRESSES[@]}; i++)); do
|
for (( i=0; i<${#KUBE_MINION_IP_ADDRESSES[@]}; i++)); do
|
||||||
IP_ADDRESS=${KUBE_MINION_IP_ADDRESSES[$i]}
|
IP_ADDRESS=${KUBE_MINION_IP_ADDRESSES[$i]}
|
||||||
@ -58,7 +70,4 @@ for (( i=0; i<${#KUBE_MINION_IP_ADDRESSES[@]}; i++)); do
|
|||||||
curl "http://${IP_ADDRESS}:8080"
|
curl "http://${IP_ADDRESS}:8080"
|
||||||
done
|
done
|
||||||
|
|
||||||
$CLOUDCFG stop myNginx
|
|
||||||
$CLOUDCFG rm myNginx
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user