mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Fix integration tests
This commit is contained in:
parent
d5ec260db8
commit
0a290506c2
@ -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)
|
||||
@ -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")
|
||||
@ -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)
|
||||
}
|
||||
|
@ -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})
|
||||
@ -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)
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user