mirror of https://github.com/knative/caching.git
[master] Auto-update dependencies (#250)
Produced via: `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh` /assign n3wscott vagababov /cc n3wscott vagababov
This commit is contained in:
parent
02bd776d27
commit
61b81b7ee6
|
@ -966,7 +966,7 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:fed37fd81954c07b624d39dbb63b0d7c1208cd26b4427e4e436abc1945f21319"
|
||||
digest = "1:581d6dbec2ea9cd6a213545bb1066f0c7d1cb8d1c8620a8e0b465382e38eaeaa"
|
||||
name = "knative.dev/pkg"
|
||||
packages = [
|
||||
"apis",
|
||||
|
@ -986,7 +986,7 @@
|
|||
"reconciler",
|
||||
]
|
||||
pruneopts = "T"
|
||||
revision = "0eed424fa4eeeea60ee42f6676420aa8c51df062"
|
||||
revision = "f68639f04b397e9b24ee9d8591db43fa448d2a9e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -997,7 +997,7 @@
|
|||
"tools/dep-collector",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "9cf64fb1b912898b2934e0e963bf3c61b96d7a2c"
|
||||
revision = "6c4e86bdb24cfaaa4163d24940e9579c208bd79d"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
"time"
|
||||
"unicode"
|
||||
|
||||
"knative.dev/pkg/kmeta"
|
||||
"knative.dev/pkg/test"
|
||||
)
|
||||
|
||||
|
@ -34,7 +35,7 @@ const (
|
|||
)
|
||||
|
||||
func init() {
|
||||
// Properly seed the random number generator so AppendRandomString() is actually random.
|
||||
// Properly seed the random number generator so RandomString() is actually random.
|
||||
// Otherwise, rerunning tests will generate the same names for the test resources, causing conflicts with
|
||||
// already existing resources.
|
||||
seed := time.Now().UTC().UnixNano()
|
||||
|
@ -49,7 +50,7 @@ func ObjectPrefixForTest(t test.T) string {
|
|||
|
||||
// ObjectNameForTest generates a random object name based on the test name.
|
||||
func ObjectNameForTest(t test.T) string {
|
||||
return AppendRandomString(ObjectPrefixForTest(t))
|
||||
return kmeta.ChildName(ObjectPrefixForTest(t), string(sep)+RandomString())
|
||||
}
|
||||
|
||||
// AppendRandomString will generate a random string that begins with prefix.
|
||||
|
@ -58,13 +59,17 @@ func ObjectNameForTest(t test.T) string {
|
|||
// This method will use "-" as the separator between the prefix and
|
||||
// the random suffix.
|
||||
func AppendRandomString(prefix string) string {
|
||||
return strings.Join([]string{prefix, RandomString()}, string(sep))
|
||||
}
|
||||
|
||||
// RandomString will generate a random string.
|
||||
func RandomString() string {
|
||||
suffix := make([]byte, randSuffixLen)
|
||||
|
||||
for i := range suffix {
|
||||
suffix[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||||
}
|
||||
|
||||
return strings.Join([]string{prefix, string(suffix)}, string(sep))
|
||||
return string(suffix)
|
||||
}
|
||||
|
||||
// MakeK8sNamePrefix converts each chunk of non-alphanumeric character into a single dash
|
||||
|
|
Loading…
Reference in New Issue