diff --git a/test/e2e/proxy.go b/test/e2e/proxy.go index 41a82765509..9b5dcffe576 100644 --- a/test/e2e/proxy.go +++ b/test/e2e/proxy.go @@ -18,6 +18,7 @@ package e2e import ( "fmt" + "math" "net/http" "strings" "sync" @@ -208,10 +209,19 @@ func nodeProxyTest(f *Framework, version, nodeDest string) { prefix := "/api/" + version node, err := pickNode(f.Client) Expect(err).NotTo(HaveOccurred()) + serviceUnavailableErrors := 0 for i := 0; i < proxyAttempts; i++ { _, status, d, err := doProxy(f, prefix+"/proxy/nodes/"+node+nodeDest) - Expect(err).NotTo(HaveOccurred()) - Expect(status).To(Equal(http.StatusOK)) - Expect(d).To(BeNumerically("<", 15*time.Second)) + if status == http.StatusServiceUnavailable { + Logf("Failed proxying node logs due to service unavailable: %v", err) + time.Sleep(time.Second) + serviceUnavailableErrors++ + } else { + Expect(err).NotTo(HaveOccurred()) + Expect(status).To(Equal(http.StatusOK)) + Expect(d).To(BeNumerically("<", 15*time.Second)) + } } + maxFailures := int(math.Floor(0.1 * float64(proxyAttempts))) + Expect(serviceUnavailableErrors).To(BeNumerically("<", maxFailures)) }