summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/testutil/testutil.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/testutil.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/testutil.go')
-rw-r--r--runsc/test/testutil/testutil.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/runsc/test/testutil/testutil.go b/runsc/test/testutil/testutil.go
index a84530287..79f0a8b6b 100644
--- a/runsc/test/testutil/testutil.go
+++ b/runsc/test/testutil/testutil.go
@@ -461,3 +461,8 @@ func WriteTmpFile(pattern, text string) (string, error) {
}
return file.Name(), nil
}
+
+// RandomName create a name with a 6 digit random number appended to it.
+func RandomName(prefix string) string {
+ return fmt.Sprintf("%s-%06d", prefix, rand.Int31n(1000000))
+}