mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Delete unused struct, nodeEnumerator
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
This commit is contained in:
parent
02ffdd1d5b
commit
a82749999d
@ -707,24 +707,6 @@ func MakeDefaultErrorFunc(client clientset.Interface, backoff *internalqueue.Pod
|
||||
}
|
||||
}
|
||||
|
||||
// nodeEnumerator allows a cache.Poller to enumerate items in a v1.NodeList
|
||||
type nodeEnumerator struct {
|
||||
*v1.NodeList
|
||||
}
|
||||
|
||||
// Len returns the number of items in the node list.
|
||||
func (ne *nodeEnumerator) Len() int {
|
||||
if ne.NodeList == nil {
|
||||
return 0
|
||||
}
|
||||
return len(ne.Items)
|
||||
}
|
||||
|
||||
// Get returns the item (and ID) with the particular index.
|
||||
func (ne *nodeEnumerator) Get(index int) interface{} {
|
||||
return &ne.Items[index]
|
||||
}
|
||||
|
||||
type binder struct {
|
||||
Client clientset.Interface
|
||||
}
|
||||
|
@ -296,32 +296,6 @@ func TestDefaultErrorFunc(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeEnumerator(t *testing.T) {
|
||||
testList := &v1.NodeList{
|
||||
Items: []v1.Node{
|
||||
{ObjectMeta: metav1.ObjectMeta{Name: "foo"}},
|
||||
{ObjectMeta: metav1.ObjectMeta{Name: "bar"}},
|
||||
{ObjectMeta: metav1.ObjectMeta{Name: "baz"}},
|
||||
},
|
||||
}
|
||||
me := nodeEnumerator{testList}
|
||||
|
||||
if e, a := 3, me.Len(); e != a {
|
||||
t.Fatalf("expected %v, got %v", e, a)
|
||||
}
|
||||
for i := range testList.Items {
|
||||
t.Run(fmt.Sprintf("node enumerator/%v", i), func(t *testing.T) {
|
||||
gotObj := me.Get(i)
|
||||
if e, a := testList.Items[i].Name, gotObj.(*v1.Node).Name; e != a {
|
||||
t.Errorf("Expected %v, got %v", e, a)
|
||||
}
|
||||
if e, a := &testList.Items[i], gotObj; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("Expected %#v, got %v#", e, a)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestBind(t *testing.T) {
|
||||
table := []struct {
|
||||
name string
|
||||
|
Loading…
Reference in New Issue
Block a user