Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwaynecarr committed Oct 2, 2014
1 parent d5ec260 commit 0a29050
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func podsOnMinions(c *client.Client, pods api.PodList) wait.ConditionFunc {
}

func runReplicationControllerTest(c *client.Client) {
ctx := api.NewDefaultContext()
data, err := ioutil.ReadFile("api/examples/controller.json")
if err != nil {
glog.Fatalf("Unexpected error: %#v", err)
Expand All @@ -191,7 +192,7 @@ func runReplicationControllerTest(c *client.Client) {
}

glog.Infof("Creating replication controllers")
if _, err := c.CreateReplicationController(&controllerRequest); err != nil {
if _, err := c.CreateReplicationController(ctx, &controllerRequest); err != nil {
glog.Fatalf("Unexpected error: %#v", err)
}
glog.Infof("Done creating replication controllers")
Expand All @@ -202,7 +203,7 @@ func runReplicationControllerTest(c *client.Client) {
}

// wait for minions to indicate they have info about the desired pods
pods, err := c.ListPods(labels.Set(controllerRequest.DesiredState.ReplicaSelector).AsSelector())
pods, err := c.ListPods(ctx, labels.Set(controllerRequest.DesiredState.ReplicaSelector).AsSelector())
if err != nil {
glog.Fatalf("FAILED: unable to get pods to list: %v", err)
}
Expand Down
9 changes: 5 additions & 4 deletions test/integration/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestClient(t *testing.T) {
}

for apiVersion, values := range testCases {
ctx := api.NewDefaultContext()
deleteAllEtcdKeys()
s := httptest.NewServer(apiserver.Handle(values.Storage, values.Codec, fmt.Sprintf("/api/%s/", apiVersion), values.selfLinker))
client := client.NewOrDie(&client.Config{Host: s.URL, Version: apiVersion})
Expand All @@ -71,7 +72,7 @@ func TestClient(t *testing.T) {
t.Errorf("expected %#v, got %#v", e, a)
}

pods, err := client.ListPods(labels.Everything())
pods, err := client.ListPods(ctx, labels.Everything())
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
Expand All @@ -92,14 +93,14 @@ func TestClient(t *testing.T) {
},
},
}
got, err := client.CreatePod(pod)
got, err := client.CreatePod(ctx, pod)
if err == nil {
t.Fatalf("unexpected non-error: %v", err)
}

// get a created pod
pod.DesiredState.Manifest.Containers[0].Image = "an-image"
got, err = client.CreatePod(pod)
got, err = client.CreatePod(ctx, pod)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
Expand All @@ -108,7 +109,7 @@ func TestClient(t *testing.T) {
}

// pod is shown, but not scheduled
pods, err = client.ListPods(labels.Everything())
pods, err = client.ListPods(ctx, labels.Everything())
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
Expand Down

0 comments on commit 0a29050

Please sign in to comment.