Skip to content

Commit

Permalink
Merge pull request #27008 from zmerlynn/e2e-routes
Browse files Browse the repository at this point in the history
Networking e2es: Wait for all nodes to be schedulable in kubeproxy and networking tests
  • Loading branch information
wojtek-t committed Jun 8, 2016
2 parents c578678 + 936297c commit 878c8d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/e2e/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ func GetReadySchedulableNodesOrDie(c *client.Client) (nodes *api.NodeList) {
}

func WaitForAllNodesSchedulable(c *client.Client) error {
return wait.PollImmediate(30*time.Second, 2*time.Hour, func() (bool, error) {
return wait.PollImmediate(30*time.Second, 4*time.Hour, func() (bool, error) {
opts := api.ListOptions{
ResourceVersion: "0",
FieldSelector: fields.Set{"spec.unschedulable": "false"}.AsSelector(),
Expand All @@ -2634,11 +2634,16 @@ func WaitForAllNodesSchedulable(c *client.Client) error {
// Ignore the error here - it will be retried.
return false, nil
}
schedulable := 0
for _, node := range nodes.Items {
if !isNodeSchedulable(&node) {
return false, nil
if isNodeSchedulable(&node) {
schedulable++
}
}
if schedulable != len(nodes.Items) {
Logf("%d/%d nodes schedulable (polling after 30s)", schedulable, len(nodes.Items))
return false, nil
}
return true, nil
})
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/kubeproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func (config *KubeProxyTestConfig) setup() {
}

By("Getting node addresses")
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(config.f.Client))
nodeList := framework.GetReadySchedulableNodesOrDie(config.f.Client)
config.externalAddrs = framework.NodeAddresses(nodeList, api.NodeExternalIP)
if len(config.externalAddrs) < 2 {
Expand Down Expand Up @@ -501,6 +502,7 @@ func (config *KubeProxyTestConfig) cleanup() {
}

func (config *KubeProxyTestConfig) createNetProxyPods(podName string, selector map[string]string) []*api.Pod {
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(config.f.Client))
nodes := framework.GetReadySchedulableNodesOrDie(config.f.Client)

// create pods, one for each node
Expand Down
1 change: 1 addition & 0 deletions test/e2e/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var _ = framework.KubeDescribe("Networking", func() {

By("Creating a webserver (pending) pod on each node")

framework.ExpectNoError(framework.WaitForAllNodesSchedulable(f.Client))
nodes := framework.GetReadySchedulableNodesOrDie(f.Client)

if len(nodes.Items) == 1 {
Expand Down

0 comments on commit 878c8d4

Please sign in to comment.