From 53d6491c695fea21ed7f87489bb2d5d16f3fa5dd Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Wed, 4 Oct 2017 16:36:29 -0700 Subject: [PATCH] Add more logging to outbound test (#1536) --- test/cluster-tests/kubernetes/k8s-utils.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/cluster-tests/kubernetes/k8s-utils.sh b/test/cluster-tests/kubernetes/k8s-utils.sh index 20dfbe01d0..59cd167bed 100644 --- a/test/cluster-tests/kubernetes/k8s-utils.sh +++ b/test/cluster-tests/kubernetes/k8s-utils.sh @@ -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 @@ -146,18 +146,24 @@ 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" @@ -165,5 +171,7 @@ function test_windows_deployment() { log "$evt" log "K8S-Windows: failed to get outbound internet connection inside simpleweb container" exit 1 + else + log "outbound connection succeeded!" fi }