Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Add more logging to outbound test (#1536)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiangtianLi authored and jackfrancis committed Oct 4, 2017
1 parent e19d2a7 commit 53d6491
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/cluster-tests/kubernetes/k8s-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function test_windows_deployment() {
while (( $count > 0 )); do
log " ... counting down $count"
query=$(kubectl exec $winpodname -- powershell nslookup www.bing.com)
if [[ $(echo ${query} | grep "DNS request timed out" | wc -l) == 0 ]]; then
if [[ $(echo ${query} | grep "DNS request timed out" | wc -l) == 0 ]] && [[ $(echo ${query} | grep "UnKnown" | wc -l) == 0 ]]; then
success="y"
break
fi
Expand All @@ -146,24 +146,32 @@ function test_windows_deployment() {
success="n"
while (( $count > 0 )); do
log " ... counting down $count"
# curl without getting status first and see the response. getting status sometimes has the problem to hang
# and it doesn't repro when running kubectl from the node
kubectl exec $winpodname -- powershell iwr -UseBasicParsing -TimeoutSec 60 www.bing.com
statuscode=$(kubectl exec $winpodname -- powershell iwr -UseBasicParsing -TimeoutSec 60 www.bing.com | grep StatusCode)
if [[ $(echo ${statuscode} | grep 200 | awk '{print $3}' | tr -d '\r') -eq "200" ]]; then
if [[ ${statuscode} != "" ]] && [[ $(echo ${statuscode} | grep 200 | awk '{print $3}' | tr -d '\r') -eq "200" ]]; then
log "got 200 status code"
log "${statuscode}"
success="y"
break
fi
log "curl failed, retrying..."
ipconfig=$(kubectl exec $winpodname -- powershell ipconfig /all)
log "$ipconfig"
sleep 10; count=$((count-1))
done
if [[ "${success}" != "y" ]]; then
nslookup=$(kubectl exec $winpodname -- powershell nslookup www.bing.com)
log "$nslookup"
ipconfig=$(kubectl exec $winpodname -- powershell ipconfig /all)
log "$ipconfig"
log "getting the last 50 events to check timeout failure"
hdr=$(kubectl get events | head -n 1)
log "$hdr"
evt=$(kubectl get events | tail -n 50)
log "$evt"
log "K8S-Windows: failed to get outbound internet connection inside simpleweb container"
exit 1
else
log "outbound connection succeeded!"
fi
}

0 comments on commit 53d6491

Please sign in to comment.