use ginkgo native timeout method

This commit is contained in:
Daniel Smith
2015-05-20 17:36:37 -07:00
parent ec1b3a7537
commit 8fdf1cca54

View File

@@ -133,7 +133,8 @@ var _ = Describe("Networking", func() {
}) })
//Now we can proceed with the test. //Now we can proceed with the test.
It("should function for intra-pod communication", func() { It("should function for intra-pod communication", func(done Done) {
defer close(done)
if testContext.Provider == "vagrant" { if testContext.Provider == "vagrant" {
By("Skipping test which is broken for vagrant (See https://github.com/GoogleCloudPlatform/kubernetes/issues/3580)") By("Skipping test which is broken for vagrant (See https://github.com/GoogleCloudPlatform/kubernetes/issues/3580)")
@@ -200,17 +201,12 @@ var _ = Describe("Networking", func() {
By("Waiting for connectivity to be verified") By("Waiting for connectivity to be verified")
const maxAttempts = 60 const maxAttempts = 60
stopBy := time.Now().Add(2 * time.Minute)
passed := false passed := false
//once response OK, evaluate response body for pass/fail. //once response OK, evaluate response body for pass/fail.
var body []byte var body []byte
for i := 0; i < maxAttempts && !passed; i++ { for i := 0; i < maxAttempts && !passed; i++ {
if time.Now().After(stopBy) {
Logf("Timeout exceeded")
break
}
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
Logf("About to make a proxy status call") Logf("About to make a proxy status call")
start := time.Now() start := time.Now()
@@ -262,6 +258,6 @@ var _ = Describe("Networking", func() {
} }
} }
Expect(string(body)).To(Equal("pass")) Expect(string(body)).To(Equal("pass"))
}) }, 120)
}) })