summaryrefslogtreecommitdiffhomepage
path: root/pkg/test/testutil
diff options
context:
space:
mode:
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.