summaryrefslogtreecommitdiffhomepage
path: root/pkg/test/dockerutil
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2020-05-21 11:06:28 -0700
committergVisor bot <gvisor-bot@google.com>2020-05-21 11:08:10 -0700
commitcdf48e851670f8f333f61e7621e0aa7d495d98fe (patch)
treea0bc2f13af52af5e4a6229542692662bec80a915 /pkg/test/dockerutil
parent7bde26934ae6d39649a31f6c77a4bc210277085a (diff)
Fix TestTmpFile
Split check for file in /tmp from working directory test. Fix readonly case which should not fail to create working dir. PiperOrigin-RevId: 312702930
Diffstat (limited to 'pkg/test/dockerutil')
-rw-r--r--pkg/test/dockerutil/dockerutil.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/test/dockerutil/dockerutil.go b/pkg/test/dockerutil/dockerutil.go
index 5f2af9f3b..06f81d28d 100644
--- a/pkg/test/dockerutil/dockerutil.go
+++ b/pkg/test/dockerutil/dockerutil.go
@@ -162,9 +162,13 @@ type Docker struct {
//
// Names of containers will be unique.
func MakeDocker(logger testutil.Logger) *Docker {
+ // Slashes are not allowed in container names.
+ name := testutil.RandomID(logger.Name())
+ name = strings.ReplaceAll(name, "/", "-")
+
return &Docker{
logger: logger,
- Name: testutil.RandomID(logger.Name()),
+ Name: name,
Runtime: *runtime,
}
}