Skip to content

Commit

Permalink
Merge pull request kubernetes#1966 from ddysher/Stop-test-server
Browse files Browse the repository at this point in the history
Stop test server in endpoint unittest.
  • Loading branch information
bgrant0607 committed Oct 27, 2014
2 parents ddea4ff + f14eebf commit 854af6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/service/endpoints_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusOK, api.ServiceList{}},
serverResponse{http.StatusOK, api.Endpoints{}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
Expand All @@ -168,6 +169,7 @@ func TestSyncEndpointsError(t *testing.T) {
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusInternalServerError, api.ServiceList{}},
serverResponse{http.StatusOK, api.Endpoints{}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err == nil {
Expand Down Expand Up @@ -196,6 +198,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
},
Endpoints: []string{"6.7.8.9:1000"},
}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
Expand Down Expand Up @@ -231,6 +234,7 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
},
Endpoints: []string{"1.2.3.4:8080"},
}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
Expand All @@ -254,6 +258,7 @@ func TestSyncEndpointsItems(t *testing.T) {
serverResponse{http.StatusOK, newPodList(1)},
serverResponse{http.StatusOK, serviceList},
serverResponse{http.StatusOK, api.Endpoints{}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
Expand Down Expand Up @@ -282,6 +287,7 @@ func TestSyncEndpointsPodError(t *testing.T) {
serverResponse{http.StatusInternalServerError, api.PodList{}},
serverResponse{http.StatusOK, serviceList},
serverResponse{http.StatusOK, api.Endpoints{}})
defer testServer.Close()
client := client.NewOrDie(&client.Config{Host: testServer.URL, Version: testapi.Version()})
endpoints := NewEndpointController(client)
if err := endpoints.SyncServiceEndpoints(); err == nil {
Expand Down

0 comments on commit 854af6b

Please sign in to comment.