mirror of https://github.com/knative/pkg.git
Drop the usage of knative.dev/pkg/test in the helpers package (#1791)
This has the side effects of pulling in a bunch of global variables
This commit is contained in:
parent
73da5142da
commit
3eb7d13dae
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"knative.dev/pkg/kmeta"
|
"knative.dev/pkg/kmeta"
|
||||||
"knative.dev/pkg/test"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -42,13 +41,17 @@ func init() {
|
||||||
rand.Seed(seed)
|
rand.Seed(seed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type named interface {
|
||||||
|
Name() string
|
||||||
|
}
|
||||||
|
|
||||||
// ObjectPrefixForTest returns the name prefix for this test's random names.
|
// ObjectPrefixForTest returns the name prefix for this test's random names.
|
||||||
func ObjectPrefixForTest(t test.T) string {
|
func ObjectPrefixForTest(t named) string {
|
||||||
return MakeK8sNamePrefix(strings.TrimPrefix(t.Name(), testNamePrefix))
|
return MakeK8sNamePrefix(strings.TrimPrefix(t.Name(), testNamePrefix))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectNameForTest generates a random object name based on the test name.
|
// ObjectNameForTest generates a random object name based on the test name.
|
||||||
func ObjectNameForTest(t test.T) string {
|
func ObjectNameForTest(t named) string {
|
||||||
return kmeta.ChildName(ObjectPrefixForTest(t), string(sep)+RandomString())
|
return kmeta.ChildName(ObjectPrefixForTest(t), string(sep)+RandomString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue