mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
Fix integration tests
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user