Skip to content

Commit cc58ae9

Browse files
authored
Merge pull request #61 from ijc/workaround-dns-timeout-in-tests
test: Retry intra-pod networking test.
2 parents 33d5e1d + 65f6d6b commit cc58ae9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/cases/000_smoke/test.exp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,15 @@ if [string match "Welcome to nginx!" $curl] {
216216
}
217217
puts "SUCCESS nginx responded well"
218218

219-
send_sshcmd {kubectl exec $(kubectl get pods -l name==alpine -o=jsonpath='{.items[*].metadata.name}') -- wget -q -O - http://nginx/}
220-
expect -i $ssh_sid -timeout 10 \
219+
# This also happens to test external connectivity...
220+
sshcmd "alpine install curl" {kubectl exec $(kubectl get pods -l name==alpine -o=jsonpath='{.items[*].metadata.name}') -- apk add --update curl}
221+
222+
# We rely on the expect -timeout to kill the infinite curl loop. The
223+
# loop is needed because it seems it sometimes takes the internal DNS
224+
# a while to settle, resulting in spurious `curl: (6) Could not
225+
# resolve host: nginx` failures.
226+
send_sshcmd {while ! kubectl exec $(kubectl get pods -l name==alpine -o=jsonpath='{.items[*].metadata.name}') -- curl -sS http://nginx/ ; do sleep 1s ; done}
227+
expect -i $ssh_sid -timeout 60 \
221228
"Welcome to nginx!" {
222229
puts "SUCCESS intra-pod networking ok"
223230
} $ssh_prompt {

0 commit comments

Comments
 (0)