kubernetes/staging/src/k8s.io/apiserver/pkg/server/genericapiserver_graceful_termination_test.go

func TestMain(m *testing.M) {}

type doer

func (d doer) Do(client *http.Client, gci func(httptrace.GotConnInfo), path string, timeout time.Duration) result {}

type result

type wrappedLifecycleSignal

func (w *wrappedLifecycleSignal) Signal() {}

func wrapLifecycleSignalsWithRecorder(t *testing.T, signals *lifecycleSignals, before func(lifecycleSignal)) {}

func wrapLifecycleSignal(t *testing.T, delegated lifecycleSignal, before, after func(_ lifecycleSignal)) lifecycleSignal {}

type signalInterceptingTestStep

func (ts signalInterceptingTestStep) done() <-chan struct{}

func (ts signalInterceptingTestStep) execute(fn func()) {}

func newSignalInterceptingTestStep() *signalInterceptingTestStep {}

//	 This test exercises the graceful termination scenario
//	 described in the following diagram
//	   - every vertical line is an independent timeline
//	   - the leftmost vertical line represents the go routine that
//	     is executing GenericAPIServer.Run method
//	   - (signal name) indicates that the given lifecycle signal has been fired
//
//	                                 stopCh
//	                                   |
//	             |--------------------------------------------|
//	             |                                            |
//		    call PreShutdownHooks                        (ShutdownInitiated)
//	             |                                            |
//	  (PreShutdownHooksStopped)                   Sleep(ShutdownDelayDuration)
//	             |                                            |
//	             |                                 (AfterShutdownDelayDuration)
//	             |                                            |
//	             |                                            |
//	             |--------------------------------------------|
//	             |                                            |
//	             |                                 (NotAcceptingNewRequest)
//	             |                                            |
//	             |                       |-------------------------------------------------|
//	             |                       |                                                 |
//	             |             close(stopHttpServerCh)                         NonLongRunningRequestWaitGroup.Wait()
//	             |                       |                                                 |
//	             |            server.Shutdown(timeout=60s)                                 |
//	             |                       |                                         WatchRequestWaitGroup.Wait()
//	             |              stop listener (net/http)                                   |
//	             |                       |                                                 |
//	             |          |-------------------------------------|                        |
//	             |          |                                     |                        |
//	             |          |                      (HTTPServerStoppedListening)            |
//	             |          |                                                              |
//	             |    wait up to 60s                                                       |
//	             |          |                                                  (InFlightRequestsDrained)
//	             |          |
//	             |          |
//	             |	stoppedCh is closed
//	             |
//	             |
//	   <-drainedCh.Signaled()
//	             |
//	  s.AuditBackend.Shutdown()
//	             |
//	     <-listenerStoppedCh
//	             |
//	        <-stoppedCh
//	             |
//	         return nil
func TestGracefulTerminationWithKeepListeningDuringGracefulTerminationDisabled(t *testing.T) {}

// This test exercises the graceful termination scenario
// described in the following diagram
//
//   - every vertical line is an independent timeline
//
//   - the leftmost vertical line represents the go routine that
//     is executing GenericAPIServer.Run method
//
//   - (signal) indicates that the given lifecycle signal has been fired
//
//     stopCh
//     |
//     |--------------------------------------------|
//     |                                            |
//     call PreShutdownHooks                       (ShutdownInitiated)
//     |                                            |
//     (PreShutdownHooksCompleted)                  Sleep(ShutdownDelayDuration)
//     |                                            |
//     |                                 (AfterShutdownDelayDuration)
//     |                                            |
//     |                                            |
//     |--------------------------------------------|
//     |                                            |
//     |                               (NotAcceptingNewRequest)
//     |                                            |
//     |                              NonLongRunningRequestWaitGroup.Wait()
//     |                                            |
//     |                                 WatchRequestWaitGroup.Wait()
//     |                                            |
//     |                                (InFlightRequestsDrained)
//     |                                            |
//     |                                            |
//     |------------------------------------------------------------|
//     |                                                            |
//     <-drainedCh.Signaled()                                     close(stopHttpServerCh)
//     |                                                            |
//     s.AuditBackend.Shutdown()                                 server.Shutdown(timeout=2s)
//     |                                                            |
//     |                                                   stop listener (net/http)
//     |                                                            |
//     |                                         |-------------------------------------|
//     |                                         |                                     |
//     |                                   wait up to 2s                 (HTTPServerStoppedListening)
//     <-listenerStoppedCh                                |
//     |                                stoppedCh is closed
//     <-stoppedCh
//     |
//     return nil
func TestGracefulTerminationWithKeepListeningDuringGracefulTerminationEnabled(t *testing.T) {}

func TestMuxAndDiscoveryComplete(t *testing.T) {}

func TestPreShutdownHooks(t *testing.T) {}

type signalRecorder

func (r *signalRecorder) before(s lifecycleSignal) {}

func (r *signalRecorder) verify(got []string) error {}

type inFlightRequest

func setupInFlightNonLongRunningRequestHandler(s *GenericAPIServer) *inFlightRequest {}

func setupInFlightWatchRequestHandler(s *GenericAPIServer) *inFlightRequest {}

func (ifr *inFlightRequest) launch(doer doer, client *http.Client) {}

func (ifr *inFlightRequest) unblockAndWaitForResult(t *testing.T) result {}

type preShutdownHookHandler

func setupPreShutdownHookHandler(t *testing.T, s *GenericAPIServer, doer doer, client *http.Client) *preShutdownHookHandler {}

type fakeAudit

func (a *fakeAudit) Run(stopCh <-chan struct{}

func (a *fakeAudit) Shutdown() {}

func (a *fakeAudit) String() string {}

func (a *fakeAudit) shutdownCompleted() bool {}

func (a *fakeAudit) ProcessEvents(events ...*auditinternal.Event) bool {}

func (a *fakeAudit) requestAudited(auditID string) bool {}

func (a *fakeAudit) EvaluatePolicyRule(attrs authorizer.Attributes) audit.RequestAuditConfig {}

func assertRequestAudited(resultGot result, backend *fakeAudit) error {}

func waitForeverUntilSignaled(t *testing.T, s lifecycleSignal) {}

func waitForeverUntil(t *testing.T, ch <-chan struct{}

func shouldReuseConnection(t *testing.T) func(httptrace.GotConnInfo) {}

func shouldUseNewConnection(t *testing.T) func(httptrace.GotConnInfo) {}

func assertResponseStatusCode(resultGot result, statusCodeExpected int) error {}

func requestMustFailWithRetryHeader(resultGot result, statusCodedExpected int) error {}

func waitForAPIServerStarted(t *testing.T, doer doer) {}

func setupDoer(t *testing.T, info *SecureServingInfo) doer {}

func newClient(useNewConnection bool) *http.Client {}

func newGenericAPIServer(t *testing.T, fAudit *fakeAudit, keepListening bool) *GenericAPIServer {}

type wrappedListener

func (ln wrappedListener) Accept() (net.Conn, error) {}