diff --git a/libcontainer/integration/template_test.go b/libcontainer/integration/template_test.go index c9ebff7e0..039cd7375 100644 --- a/libcontainer/integration/template_test.go +++ b/libcontainer/integration/template_test.go @@ -2,6 +2,7 @@ package integration import ( "strconv" + "strings" "testing" "time" @@ -215,7 +216,7 @@ func newTemplateConfig(t *testing.T, p *tParam) *configs.Config { if p.systemd { id := strconv.FormatInt(-int64(time.Now().Nanosecond()), 36) - config.Cgroups.Name = t.Name() + id + config.Cgroups.Name = strings.ReplaceAll(t.Name(), "/", "_") + id // do not change Parent (see newContainer) config.Cgroups.Parent = "system.slice" config.Cgroups.ScopePrefix = "runc-test" diff --git a/libcontainer/integration/utils_test.go b/libcontainer/integration/utils_test.go index 0ffbf179b..b4fa6cf65 100644 --- a/libcontainer/integration/utils_test.go +++ b/libcontainer/integration/utils_test.go @@ -151,7 +151,7 @@ func copyBusybox(dest string) error { } func newContainer(t *testing.T, config *configs.Config) (libcontainer.Container, error) { - name := t.Name() + strconv.FormatInt(int64(time.Now().Nanosecond()), 35) + name := strings.ReplaceAll(t.Name(), "/", "_") + strconv.FormatInt(-int64(time.Now().Nanosecond()), 35) root, err := newTestRoot() if err != nil { return nil, err