mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #84427 from YuikoTakada/local-DescribeItem
Change DescribeItem() to local func
This commit is contained in:
commit
ee4e1465ea
@ -165,7 +165,7 @@ func (f *Framework) CreateItems(items ...interface{}) (func(), error) {
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
// Each factory knows which item(s) it supports, so try each one.
|
// Each factory knows which item(s) it supports, so try each one.
|
||||||
done := false
|
done := false
|
||||||
description := DescribeItem(item)
|
description := describeItem(item)
|
||||||
// Uncomment this line to get a full dump of the entire item.
|
// Uncomment this line to get a full dump of the entire item.
|
||||||
// description = fmt.Sprintf("%s:\n%s", description, PrettyPrint(item))
|
// description = fmt.Sprintf("%s:\n%s", description, PrettyPrint(item))
|
||||||
Logf("creating %s", description)
|
Logf("creating %s", description)
|
||||||
@ -260,11 +260,11 @@ type ItemFactory interface {
|
|||||||
Create(f *Framework, item interface{}) (func() error, error)
|
Create(f *Framework, item interface{}) (func() error, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DescribeItem always returns a string that describes the item,
|
// describeItem always returns a string that describes the item,
|
||||||
// usually by calling out to cache.MetaNamespaceKeyFunc which
|
// usually by calling out to cache.MetaNamespaceKeyFunc which
|
||||||
// concatenates namespace (if set) and name. If that fails, the entire
|
// concatenates namespace (if set) and name. If that fails, the entire
|
||||||
// item gets converted to a string.
|
// item gets converted to a string.
|
||||||
func DescribeItem(item interface{}) string {
|
func describeItem(item interface{}) string {
|
||||||
key, err := cache.MetaNamespaceKeyFunc(item)
|
key, err := cache.MetaNamespaceKeyFunc(item)
|
||||||
if err == nil && key != "" {
|
if err == nil && key != "" {
|
||||||
return fmt.Sprintf("%T: %s", item, key)
|
return fmt.Sprintf("%T: %s", item, key)
|
||||||
|
Loading…
Reference in New Issue
Block a user