mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/int: allow subtests
The t.Name() usage in libcontainer/integration prevented subtests
to be used, since in such case it returns a string containing "/",
and thus it can't be used to name a container.
Fix this by replacing slashes with underscores where appropriate.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit af1688a544)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user