mirror of https://github.com/k3s-io/k3s
commit
e485fafc17
|
@ -61,6 +61,9 @@ func TestMaxInFlight(t *testing.T) {
|
|||
const Iterations = 3
|
||||
block := sync.WaitGroup{}
|
||||
block.Add(1)
|
||||
oneFinished := sync.WaitGroup{}
|
||||
oneFinished.Add(1)
|
||||
var once sync.Once
|
||||
sem := make(chan bool, Iterations)
|
||||
|
||||
re := regexp.MustCompile("[.*\\/watch][^\\/proxy.*]")
|
||||
|
@ -85,6 +88,7 @@ func TestMaxInFlight(t *testing.T) {
|
|||
// These should hang waiting on block...
|
||||
go func() {
|
||||
expectHTTP(server.URL+"/foo/bar/watch", http.StatusOK, t)
|
||||
once.Do(oneFinished.Done)
|
||||
}()
|
||||
}
|
||||
|
||||
|
@ -92,6 +96,7 @@ func TestMaxInFlight(t *testing.T) {
|
|||
// These should hang waiting on block...
|
||||
go func() {
|
||||
expectHTTP(server.URL+"/proxy/foo/bar", http.StatusOK, t)
|
||||
once.Do(oneFinished.Done)
|
||||
}()
|
||||
}
|
||||
expectHTTP(server.URL+"/dontwait", http.StatusOK, t)
|
||||
|
@ -100,6 +105,7 @@ func TestMaxInFlight(t *testing.T) {
|
|||
// These should hang waiting on block...
|
||||
go func() {
|
||||
expectHTTP(server.URL, http.StatusOK, t)
|
||||
once.Do(oneFinished.Done)
|
||||
}()
|
||||
}
|
||||
calls.Wait()
|
||||
|
@ -116,6 +122,8 @@ func TestMaxInFlight(t *testing.T) {
|
|||
block.Done()
|
||||
|
||||
// Show that we recover from being blocked up.
|
||||
// However, we should until at least one of the requests really finishes.
|
||||
oneFinished.Wait()
|
||||
expectHTTP(server.URL, http.StatusOK, t)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue