Port the downward api test to the node e2e suite

Also extend the framework to allow a custom client config loading function, so
that the node e2e suite can reuse the same framework across tests.
This commit is contained in:
Yu-Ju Hong
2016-06-03 18:10:33 -07:00
parent 525140a278
commit a6a3ed210c
5 changed files with 191 additions and 16 deletions

View File

@@ -197,10 +197,6 @@ func waitForPodRunning(c *client.Client, ns string, name string) error {
return fmt.Errorf("Time out while waiting for pod %s/%s to become running; current status: %+v", ns, name, pod.Status)
}
func setNodeNameForPod(pod *api.Pod) {
pod.Spec.NodeName = *nodeName
}
func createPodAndWaitUntilRunning(c *client.Client, pod *api.Pod) *api.Pod {
ref := fmt.Sprintf("%v/%v", pod.Namespace, pod.Name)
_, err := createPodWithSpec(c, pod)
@@ -215,8 +211,7 @@ func createPodAndWaitUntilRunning(c *client.Client, pod *api.Pod) *api.Pod {
func createPodWithSpec(c *client.Client, pod *api.Pod) (*api.Pod, error) {
// Manually assign pod to node because we don't run the scheduler in node
// e2e tests.
// TODO: This should also be a shared utility function.
setNodeNameForPod(pod)
assignPodToNode(pod)
createdPod, err := c.Pods(pod.Namespace).Create(pod)
return createdPod, err
}