mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
Clean shutdown of test apiserver
This commit is contained in:
@@ -70,7 +70,14 @@ func TestGracefulShutdown(t *testing.T) {
|
||||
resp.Body.Close()
|
||||
|
||||
t.Logf("shutting down server")
|
||||
tearDownOnce.Do(server.TearDownFn)
|
||||
// We tear it down in the background to ensure that
|
||||
// pending requests should work fine.
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
tearDownOnce.Do(server.TearDownFn)
|
||||
}()
|
||||
|
||||
t.Logf("server should fail new requests")
|
||||
if err := wait.Poll(time.Millisecond*100, wait.ForeverTestTimeout, func() (done bool, err error) {
|
||||
@@ -100,6 +107,8 @@ func TestGracefulShutdown(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("response: code %d, body: %s", respErr.resp.StatusCode, string(bs))
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
type responseErrorPair struct {
|
||||
|
Reference in New Issue
Block a user