Delete unused struct, nodeEnumerator

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
This commit is contained in:
PingWang 2019-04-16 17:57:22 +08:00
parent 02ffdd1d5b
commit a82749999d
2 changed files with 0 additions and 44 deletions

View File

@ -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
}

View File

@ -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