add description to timeout messages
This commit is contained in:
@@ -1004,9 +1004,10 @@ func testReachable(ip string, port int) {
|
||||
Failf("Got port==0 for reachability check (%s)", url)
|
||||
}
|
||||
|
||||
By(fmt.Sprintf("Waiting up to %v for %s to be reachable", podStartTimeout, url))
|
||||
desc := fmt.Sprintf("the url %s to be reachable", url)
|
||||
By(fmt.Sprintf("Waiting up to %v for %s", podStartTimeout, desc))
|
||||
start := time.Now()
|
||||
expectNoError(wait.Poll(poll, podStartTimeout, func() (bool, error) {
|
||||
err := wait.Poll(poll, podStartTimeout, func() (bool, error) {
|
||||
resp, err := httpGetNoConnectionPool(url)
|
||||
if err != nil {
|
||||
Logf("Got error waiting for reachability of %s: %v (%v)", url, err, time.Since(start))
|
||||
@@ -1026,7 +1027,8 @@ func testReachable(ip string, port int) {
|
||||
}
|
||||
Logf("Successfully reached %v", url)
|
||||
return true, nil
|
||||
}))
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred(), "Error waiting for %s", desc)
|
||||
}
|
||||
|
||||
func testNotReachable(ip string, port int) {
|
||||
@@ -1038,11 +1040,12 @@ func testNotReachable(ip string, port int) {
|
||||
Failf("Got port==0 for non-reachability check (%s)", url)
|
||||
}
|
||||
|
||||
By(fmt.Sprintf("Waiting up to %v for %s to be *not* reachable", podStartTimeout, url))
|
||||
expectNoError(wait.Poll(poll, podStartTimeout, func() (bool, error) {
|
||||
desc := fmt.Sprintf("the url %s to be *not* reachable", url)
|
||||
By(fmt.Sprintf("Waiting up to %v for %s", podStartTimeout, desc))
|
||||
err := wait.Poll(poll, podStartTimeout, func() (bool, error) {
|
||||
resp, err := httpGetNoConnectionPool(url)
|
||||
if err != nil {
|
||||
Logf("Successfully waited for the url %s to be unreachable.", url)
|
||||
Logf("Successfully waited for %s", desc)
|
||||
return true, nil
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
@@ -1053,7 +1056,8 @@ func testNotReachable(ip string, port int) {
|
||||
}
|
||||
Logf("Able to reach service %s when should no longer have been reachable, status:%d and body: %s", url, resp.Status, string(body))
|
||||
return false, nil
|
||||
}))
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred(), "Error waiting for %s", desc)
|
||||
}
|
||||
|
||||
// Does an HTTP GET, but does not reuse TCP connections
|
||||
|
Reference in New Issue
Block a user