mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
wait for poststarthook/max-in-flight-filter to be initialized asynchronously
Signed-off-by: pacoxu <paco.xu@daocloud.io>
This commit is contained in:
parent
f101acdbe2
commit
3c4eb55b4a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user