Skip to content

Commit

Permalink
test: Use longer timeout for ginkgo DNS lookups
Browse files Browse the repository at this point in the history
FQDN tests have been failing due to DNS lookups from ginkgo not
succeeding in 30 seconds. Use the longer HelperTimeout (4 minutes)
instead.

Also split the two lookups into two separate WithTimeout()
invocations, so that we do not need to repeat the 1st if the 2nd
fails.

Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
  • Loading branch information
jrajahalme committed Jun 12, 2020
1 parent a8066ce commit ae31e75
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/k8sT/fqdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,27 @@ var _ = Describe("K8sFQDNTest", func() {
// In case the IPs changed from above, update them here
var lookupErr error
err := helpers.WithTimeout(func() bool {
var addrs []string
addrs, lookupErr = net.LookupHost("vagrant-cache.ci.cilium.io")
if lookupErr != nil {
lookupErr = fmt.Errorf("error looking up vagrant-cache.ci.cilium.io: %s", lookupErr)
addrs, err2 := net.LookupHost("vagrant-cache.ci.cilium.io")
if err2 != nil {
lookupErr = fmt.Errorf("error looking up vagrant-cache.ci.cilium.io: %s", err2)
return false
}
worldTargetIP = addrs[0]

addrs, lookupErr = net.LookupHost("jenkins.cilium.io")
if lookupErr != nil {
lookupErr = fmt.Errorf("error looking up jenkins.cilium.io: %s", lookupErr)
return true
}, "Could not get vagrant-cache.ci.cilium.io IP", &helpers.TimeoutConfig{Timeout: helpers.HelperTimeout})
Expect(err).Should(BeNil(), "Error obtaining IP for test: %s", lookupErr)

lookupErr = nil
err = helpers.WithTimeout(func() bool {
addrs, err2 := net.LookupHost("jenkins.cilium.io")
if err2 != nil {
lookupErr = fmt.Errorf("error looking up jenkins.cilium.io: %s", err2)
return false
}
worldInvalidTargetIP = addrs[0]

return true
}, "Could not get vagrant-cache.ci.cilium.io and jenkins.cilium.io IPs", &helpers.TimeoutConfig{Timeout: helpers.MidCommandTimeout})
Expect(err).Should(BeNil(), "Error obtaining IPs for test: %s", lookupErr)
}, "Could not get jenkins.cilium.io IP", &helpers.TimeoutConfig{Timeout: helpers.HelperTimeout})
Expect(err).Should(BeNil(), "Error obtaining IP for test: %s", lookupErr)

kubectl = helpers.CreateKubectl(helpers.K8s1VMName(), logger)
demoManifest = helpers.ManifestGet(kubectl.BasePath(), "demo.yaml")
Expand Down

0 comments on commit ae31e75

Please sign in to comment.