Add an integration test for services.

This commit is contained in:
Brendan Burns
2014-10-02 20:24:30 -07:00
parent d131ad640a
commit f00fd8d2e3
2 changed files with 73 additions and 5 deletions

View File

@@ -62,8 +62,8 @@ func (e *EndpointController) SyncServiceEndpoints() error {
resultErr = err
continue
}
endpoints := make([]string, len(pods.Items))
for ix, pod := range pods.Items {
endpoints := []string{}
for _, pod := range pods.Items {
port, err := findPort(&pod.DesiredState.Manifest, service.ContainerPort)
if err != nil {
glog.Errorf("Failed to find port for service: %v, %v", service, err)
@@ -73,7 +73,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
glog.Errorf("Failed to find an IP for pod: %v", pod)
continue
}
endpoints[ix] = net.JoinHostPort(pod.CurrentState.PodIP, strconv.Itoa(port))
endpoints = append(endpoints, net.JoinHostPort(pod.CurrentState.PodIP, strconv.Itoa(port)))
}
currentEndpoints, err := e.client.GetEndpoints(nsCtx, service.ID)
if err != nil {