API server: Add shutdown func to interface (#88827)
add shutdown func to interface
This commit is contained in:
@@ -80,6 +80,8 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{}
|
||||
tracer.InitTracer(o.Options.TracingOptions.TracingService)
|
||||
}
|
||||
|
||||
defer o.factory.Shutdown()
|
||||
|
||||
if err := o.RunAPIServer(config, stopCh); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ type APIServerFactory interface {
|
||||
|
||||
// Make an API server for a given group+version
|
||||
MakeAPIServer(ctx context.Context, tracer tracing.Tracer, gv schema.GroupVersion) (builder.APIGroupBuilder, error)
|
||||
|
||||
Shutdown()
|
||||
}
|
||||
|
||||
// Zero dependency provider for testing
|
||||
@@ -114,6 +116,8 @@ func (p *DummyAPIFactory) MakeAPIServer(_ context.Context, tracer tracing.Tracer
|
||||
return nil, fmt.Errorf("unsupported group")
|
||||
}
|
||||
|
||||
func (p *DummyAPIFactory) Shutdown() {}
|
||||
|
||||
// Simple stub for standalone datasource testing
|
||||
type pluginDatasourceImpl struct {
|
||||
startup v1.Time
|
||||
|
||||
Reference in New Issue
Block a user