func createMaxInflightServer(t *testing.T, callsWg, blockWg *sync.WaitGroup, disableCallsWg *bool, disableCallsWgMutex *sync.Mutex, nonMutating, mutating int) *httptest.Server { … } func withFakeUser(handler http.Handler) http.Handler { … } // Tests that MaxInFlightLimit works, i.e. // - "long" requests such as proxy or watch, identified by regexp are not accounted despite // hanging for the long time, // - "short" requests are correctly accounted, i.e. there can be only size of channel passed to the // constructor in flight at any given moment, // - subsequent "short" requests are rejected instantly with appropriate error, // - subsequent "long" requests are handled normally, // - we correctly recover after some "short" requests finish, i.e. we can process new ones. func TestMaxInFlightNonMutating(t *testing.T) { … } func TestMaxInFlightMutating(t *testing.T) { … } // We use GET as a sample non-mutating request. func expectHTTPGet(url string, code int) error { … } // We use POST as a sample mutating request. func expectHTTPPost(url string, code int, groups ...string) error { … } func TestMaxInFlightSkipsMasters(t *testing.T) { … }