Unit test endpoints controller service deletion

This commit is contained in:
Tim Allclair 2019-07-31 15:09:35 -07:00
parent b2a02140db
commit 8fc988e7dd

View File

@ -1708,3 +1708,20 @@ func TestPodDeleteBatching(t *testing.T) {
})
}
}
func TestSyncEndpointsServiceNotFound(t *testing.T) {
ns := metav1.NamespaceDefault
testServer, endpointsHandler := makeTestServer(t, ns)
defer testServer.Close()
endpoints := newController(testServer.URL, 0)
endpoints.endpointsStore.Add(&v1.Endpoints{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: ns,
ResourceVersion: "1",
},
})
endpoints.syncService(ns + "/foo")
endpointsHandler.ValidateRequestCount(t, 1)
endpointsHandler.ValidateRequest(t, testapi.Default.ResourcePath("endpoints", ns, "foo"), "DELETE", nil)
}