summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/testutil/docker.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-02-25 19:20:52 -0800
committerShentubot <shentubot@google.com>2019-02-25 19:21:47 -0800
commit52a2abfca43cffdb9cafb91a4266dacf51525470 (patch)
tree9a20ef60a4ecaf232749e5d22408c5c2d3de765f /runsc/test/testutil/docker.go
parent563c9ed1d6814776aa22d3a272fe55c15143fe79 (diff)
Fix cgroup when path is relative
This can happen when 'docker run --cgroup-parent=' flag is set. PiperOrigin-RevId: 235645559 Change-Id: Ieea3ae66939abadab621053551bf7d62d412e7ee
Diffstat (limited to 'runsc/test/testutil/docker.go')
-rw-r--r--runsc/test/testutil/docker.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go
index 5a92a5835..bce609061 100644
--- a/runsc/test/testutil/docker.go
+++ b/runsc/test/testutil/docker.go
@@ -18,7 +18,6 @@ import (
"fmt"
"io/ioutil"
"log"
- "math/rand"
"os"
"os/exec"
"path"
@@ -31,10 +30,6 @@ import (
"github.com/kr/pty"
)
-func init() {
- rand.Seed(time.Now().UnixNano())
-}
-
func getRuntime() string {
r := os.Getenv("RUNSC_RUNTIME")
if r == "" {
@@ -162,8 +157,7 @@ type Docker struct {
// MakeDocker sets up the struct for a Docker container.
// Names of containers will be unique.
func MakeDocker(namePrefix string) Docker {
- suffix := fmt.Sprintf("-%06d", rand.Int())[:7]
- return Docker{Name: namePrefix + suffix, Runtime: getRuntime()}
+ return Docker{Name: RandomName(namePrefix), Runtime: getRuntime()}
}
// Create calls 'docker create' with the arguments provided.