Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit a39d4f5

Browse files
authored
fix tests for reverting the delay in trace (#343)
1 parent 4b605dd commit a39d4f5

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

integration/retry_test.go

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var _ = Describe("Retries", func() {
3636
BeforeEach(func() {
3737
appURL = "bad-app." + test_util.LocalhostDNS
3838

39-
badApp = common.NewTcpApp([]route.Uri{route.Uri(appURL)}, testState.cfg.Port, testState.mbusClient, nil, "")
39+
badApp = common.NewTcpApp([]route.Uri{route.Uri(appURL)}, test_util.NextAvailPort(), testState.mbusClient, nil, "")
4040
badApp.Register()
4141
})
4242

@@ -70,16 +70,25 @@ var _ = Describe("Retries", func() {
7070
badApp.SetHandlers(handlers)
7171
badApp.Listen()
7272

73-
req := testState.newPostRequest(
74-
fmt.Sprintf("http://%s", appURL),
75-
bytes.NewReader([]byte(payload)),
76-
)
77-
resp, err := testState.client.Do(req)
78-
Expect(err).NotTo(HaveOccurred())
79-
Expect(resp.StatusCode).To(Equal(200))
80-
if resp.Body != nil {
81-
resp.Body.Close()
73+
successSeen := false
74+
// we need to retry the entire http request many times to get a success until https://github.com/golang/go/issues/31259
75+
// is resolved.
76+
for i := 0; i < 100; i++ {
77+
req := testState.newPostRequest(
78+
fmt.Sprintf("http://%s", appURL),
79+
bytes.NewReader([]byte(payload)),
80+
)
81+
resp, err := testState.client.Do(req)
82+
Expect(err).NotTo(HaveOccurred())
83+
if resp.StatusCode == http.StatusOK {
84+
successSeen = true
85+
break
86+
}
87+
if resp.Body != nil {
88+
resp.Body.Close()
89+
}
8290
}
91+
Expect(successSeen).To(BeTrue())
8392
})
8493
})
8594
})

0 commit comments

Comments
 (0)