mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-14 14:14:15 +00:00
runtime: don't start shim management server in tests
Shim management server is running in a go routine, in test mode this will cause the directory where the listen socket file(/run/vc/sbs/777-77-77777777/shim-monitor.sock) in leak after the tests finished. Fixes: #2805 Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
parent
988eb95621
commit
5c77cc2c49
@ -39,6 +39,13 @@ import (
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci"
|
||||
)
|
||||
|
||||
type startManagementServerFunc func(s *service, ctx context.Context, ociSpec *specs.Spec)
|
||||
|
||||
var defaultStartManagementServerFunc startManagementServerFunc = func(s *service, ctx context.Context, ociSpec *specs.Spec) {
|
||||
go s.startManagementServer(ctx, ociSpec)
|
||||
shimLog.Info("management server started")
|
||||
}
|
||||
|
||||
func create(ctx context.Context, s *service, r *taskAPI.CreateTaskRequest) (*container, error) {
|
||||
rootFs := vc.RootFs{}
|
||||
if len(r.Rootfs) == 1 {
|
||||
@ -131,7 +138,9 @@ func create(ctx context.Context, s *service, r *taskAPI.CreateTaskRequest) (*con
|
||||
}
|
||||
s.hpid = uint32(pid)
|
||||
|
||||
go s.startManagementServer(ctx, ociSpec)
|
||||
if defaultStartManagementServerFunc != nil {
|
||||
defaultStartManagementServerFunc(s, ctx, ociSpec)
|
||||
}
|
||||
|
||||
case vc.PodContainer:
|
||||
span, ctx := katatrace.Trace(s.ctx, shimLog, "create", shimTracingTags)
|
||||
|
@ -125,6 +125,10 @@ func init() {
|
||||
}
|
||||
|
||||
tc = ktu.NewTestConstraint(false)
|
||||
|
||||
// disable shim management server.
|
||||
// all tests are not using this, so just set it to nil
|
||||
defaultStartManagementServerFunc = nil
|
||||
}
|
||||
|
||||
// createOCIConfig creates an OCI configuration (spec) file in
|
||||
|
Loading…
Reference in New Issue
Block a user