cleanup: move scheduler plugin tests to use PodWrapper
Move scheduler plugin unit tests use testing PodWrapper where applicable to reduce duplicating pod creation code and shorten number of lines. Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
st "k8s.io/kubernetes/pkg/scheduler/testing"
|
||||
)
|
||||
|
||||
func TestGetPodServices(t *testing.T) {
|
||||
@@ -48,16 +49,11 @@ func TestGetPodServices(t *testing.T) {
|
||||
}
|
||||
var pods []*v1.Pod
|
||||
for i := 0; i < 5; i++ {
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "test",
|
||||
Name: fmt.Sprintf("test-pod-%d", i),
|
||||
Labels: map[string]string{
|
||||
"app": fmt.Sprintf("test-%d", i),
|
||||
"label": fmt.Sprintf("label-%d", i),
|
||||
},
|
||||
},
|
||||
}
|
||||
pod := st.MakePod().Name(fmt.Sprintf("test-pod-%d", i)).
|
||||
Namespace("test").
|
||||
Label("app", fmt.Sprintf("test-%d", i)).
|
||||
Label("label", fmt.Sprintf("label-%d", i)).
|
||||
Obj()
|
||||
pods = append(pods, pod)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user