summaryrefslogtreecommitdiffhomepage
path: root/pkg/test/testutil
diff options
context:
space:
mode:
authorIan Lewis <ianlewis@google.com>2020-06-11 19:29:34 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-11 19:31:24 -0700
commit8ea99d58ffd708aa7a26be58d89cb817d8eceec6 (patch)
treed5ff8477c5f13082364398cc20e73781322921a0 /pkg/test/testutil
parent5a894e35a090232085fbb20c71d1787c266bd995 (diff)
Set the HOME environment variable for sub-containers.
Fixes #701 PiperOrigin-RevId: 316025635
Diffstat (limited to 'pkg/test/testutil')
-rw-r--r--pkg/test/testutil/testutil.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/test/testutil/testutil.go b/pkg/test/testutil/testutil.go
index ee8c78014..f21d6769a 100644
--- a/pkg/test/testutil/testutil.go
+++ b/pkg/test/testutil/testutil.go
@@ -251,7 +251,10 @@ func RandomID(prefix string) string {
if _, err := rand.Read(b); err != nil {
panic("rand.Read failed: " + err.Error())
}
- return fmt.Sprintf("%s-%s", prefix, base32.StdEncoding.EncodeToString(b))
+ if prefix != "" {
+ prefix = prefix + "-"
+ }
+ return fmt.Sprintf("%s%s", prefix, base32.StdEncoding.EncodeToString(b))
}
// RandomContainerID generates a random container id for each test.