1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 22:57:35 +01:00

Implement node selectors to retrieve node list based on provided query.

This commit is contained in:
Avesh Agarwal
2017-11-08 16:11:28 -05:00
parent 5d3f987dde
commit c29c9db41e
6 changed files with 36 additions and 4 deletions

View File

@@ -80,3 +80,20 @@ func TestReadyNodes(t *testing.T) {
}
}
func TestReadyNodesWithNodeSelector(t *testing.T) {
node1 := test.BuildTestNode("node1", 1000, 2000, 9)
node1.Labels = map[string]string{"type": "compute"}
node2 := test.BuildTestNode("node2", 1000, 2000, 9)
node2.Labels = map[string]string{"type": "infra"}
fakeClient := fake.NewSimpleClientset(node1, node2)
nodeSelector := "type=compute"
stopChannel := make(chan struct{})
nodes, _ := ReadyNodes(fakeClient, nodeSelector, stopChannel)
if nodes[0].Name != "node1" {
t.Errorf("Expected node1, got %s", nodes[0].Name)
}
}