mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Retry 'service unavailable' failures in proxy test
This commit is contained in:
parent
1e2e38ad19
commit
8d98ad7a76
@ -18,6 +18,7 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -208,10 +209,19 @@ func nodeProxyTest(f *Framework, version, nodeDest string) {
|
|||||||
prefix := "/api/" + version
|
prefix := "/api/" + version
|
||||||
node, err := pickNode(f.Client)
|
node, err := pickNode(f.Client)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
serviceUnavailableErrors := 0
|
||||||
for i := 0; i < proxyAttempts; i++ {
|
for i := 0; i < proxyAttempts; i++ {
|
||||||
_, status, d, err := doProxy(f, prefix+"/proxy/nodes/"+node+nodeDest)
|
_, status, d, err := doProxy(f, prefix+"/proxy/nodes/"+node+nodeDest)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
if status == http.StatusServiceUnavailable {
|
||||||
Expect(status).To(Equal(http.StatusOK))
|
Logf("Failed proxying node logs due to service unavailable: %v", err)
|
||||||
Expect(d).To(BeNumerically("<", 15*time.Second))
|
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))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user