Unverified Commit bc406490 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #73516 from mfojtik/fix-post-hook-test

Wait for post-hooks to run before checking the healthz output
parents 153bc233 8a2f709b
......@@ -56,7 +56,9 @@ func TestNewWithDelegate(t *testing.T) {
w.WriteHeader(http.StatusForbidden)
})
delegatePostStartHookChan := make(chan struct{})
delegateServer.AddPostStartHook("delegate-post-start-hook", func(context PostStartHookContext) error {
defer close(delegatePostStartHookChan)
return nil
})
......@@ -82,7 +84,9 @@ func TestNewWithDelegate(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
})
wrappingPostStartHookChan := make(chan struct{})
wrappingServer.AddPostStartHook("wrapping-post-start-hook", func(context PostStartHookContext) error {
defer close(wrappingPostStartHookChan)
return nil
})
......@@ -94,6 +98,10 @@ func TestNewWithDelegate(t *testing.T) {
server := httptest.NewServer(wrappingServer.Handler)
defer server.Close()
// Wait for the hooks to finish before checking the response
<-delegatePostStartHookChan
<-wrappingPostStartHookChan
checkPath(server.URL, http.StatusOK, `{
"paths": [
"/apis",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment