Merge pull request #101777 from pacoxu/flake-apiserver-config

wait for poststarthook/max-in-flight-filter to be initialized
This commit is contained in:
Kubernetes Prow Robot 2021-05-10 09:45:33 -07:00 committed by GitHub
commit 4c6c3f39f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ import (
"github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/waitgroup"
auditinternal "k8s.io/apiserver/pkg/apis/audit"
"k8s.io/apiserver/pkg/audit"
@ -179,6 +180,24 @@ func TestNewWithDelegate(t *testing.T) {
"/readyz/shutdown",
}
checkExpectedPathsAtRoot(server.URL, expectedPaths, t)
// wait for health (max-in-flight-filter is initialized asynchronously, can take a few milliseconds to initialize)
if err := wait.PollImmediate(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) {
// healthz checks are installed in PrepareRun
resp, err := http.Get(server.URL + "/healthz?exclude=wrapping-health&exclude=delegate-health")
if err != nil {
t.Fatal(err)
}
data, _ := ioutil.ReadAll(resp.Body)
if http.StatusOK != resp.StatusCode {
t.Logf("got %d", resp.StatusCode)
t.Log(string(data))
return false, nil
}
return true, nil
}); err != nil {
t.Fatal(err)
}
checkPath(server.URL+"/healthz", http.StatusInternalServerError, `[+]ping ok
[+]log ok
[-]wrapping-health failed: reason withheld