Update unit tests to pass a context on client create

This commit is contained in:
derekwaynecarr
2014-09-30 14:27:56 -04:00
parent b7b1193919
commit 02e1a2e79d
5 changed files with 53 additions and 37 deletions

View File

@@ -159,7 +159,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusOK, api.ServiceList{}},
serverResponse{http.StatusOK, api.Endpoints{}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -172,7 +172,7 @@ func TestSyncEndpointsError(t *testing.T) {
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusInternalServerError, api.ServiceList{}},
serverResponse{http.StatusOK, api.Endpoints{}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{
Err: fmt.Errorf("test error"),
}
@@ -203,7 +203,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
},
Endpoints: []string{"6.7.8.9:1000"},
}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -239,7 +239,7 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
},
Endpoints: []string{"1.2.3.4:8080"},
}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -263,7 +263,7 @@ func TestSyncEndpointsItems(t *testing.T) {
serverResponse{http.StatusOK, newPodList(1)},
serverResponse{http.StatusOK, serviceList},
serverResponse{http.StatusOK, api.Endpoints{}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -292,7 +292,7 @@ func TestSyncEndpointsPodError(t *testing.T) {
serverResponse{http.StatusInternalServerError, api.PodList{}},
serverResponse{http.StatusOK, serviceList},
serverResponse{http.StatusOK, api.Endpoints{}})
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
client := client.NewOrDie(api.NewContext(), testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{
List: api.ServiceList{
Items: []api.Service{