|
|
@ -209,7 +209,7 @@ func TestCreate(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestUpdate(t *testing.T) {
|
|
|
|
func TestUpdate(t *testing.T) {
|
|
|
|
listA := newPodList("starfish", "otter", "squid")
|
|
|
|
listA := newPodList("starfish", "otter", "squid", "notfound")
|
|
|
|
listB := newPodList("starfish", "otter", "dolphin")
|
|
|
|
listB := newPodList("starfish", "otter", "dolphin")
|
|
|
|
listC := newPodList("starfish", "otter", "dolphin")
|
|
|
|
listC := newPodList("starfish", "otter", "dolphin")
|
|
|
|
listB.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}}
|
|
|
|
listB.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}}
|
|
|
@ -264,6 +264,11 @@ func TestUpdate(t *testing.T) {
|
|
|
|
return newResponse(200, &listB.Items[1])
|
|
|
|
return newResponse(200, &listB.Items[1])
|
|
|
|
case p == "/namespaces/default/pods/squid" && m == "GET":
|
|
|
|
case p == "/namespaces/default/pods/squid" && m == "GET":
|
|
|
|
return newResponse(200, &listB.Items[2])
|
|
|
|
return newResponse(200, &listB.Items[2])
|
|
|
|
|
|
|
|
case p == "/namespaces/default/pods/notfound" && m == "GET":
|
|
|
|
|
|
|
|
return newResponse(200, &listA.Items[3])
|
|
|
|
|
|
|
|
case p == "/namespaces/default/pods/notfound" && m == "DELETE":
|
|
|
|
|
|
|
|
// got the item when GET, but not found when DELETE, it should not fail
|
|
|
|
|
|
|
|
return newResponse(404, notFoundBody())
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
t.Fatalf("unexpected request: %s %s", req.Method, req.URL.Path)
|
|
|
|
t.Fatalf("unexpected request: %s %s", req.Method, req.URL.Path)
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -317,6 +322,8 @@ func TestUpdate(t *testing.T) {
|
|
|
|
"/namespaces/default/pods:POST", // retry due to 409
|
|
|
|
"/namespaces/default/pods:POST", // retry due to 409
|
|
|
|
"/namespaces/default/pods/squid:GET",
|
|
|
|
"/namespaces/default/pods/squid:GET",
|
|
|
|
"/namespaces/default/pods/squid:DELETE",
|
|
|
|
"/namespaces/default/pods/squid:DELETE",
|
|
|
|
|
|
|
|
"/namespaces/default/pods/notfound:GET",
|
|
|
|
|
|
|
|
"/namespaces/default/pods/notfound:DELETE",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(expectedActions) != len(actions) {
|
|
|
|
if len(expectedActions) != len(actions) {
|
|
|
|
t.Fatalf("unexpected number of requests, expected %d, got %d", len(expectedActions), len(actions))
|
|
|
|
t.Fatalf("unexpected number of requests, expected %d, got %d", len(expectedActions), len(actions))
|
|
|
|