mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 22:20:18 +00:00
Rename JSONBase -> TypeMeta in preparation for v1beta3
Will make subsequent refactor much easier
This commit is contained in:
@@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
func TestServices(t *testing.T) {
|
||||
service := api.Service{JSONBase: api.JSONBase{ID: "bar", ResourceVersion: uint64(2)}}
|
||||
service := api.Service{TypeMeta: api.TypeMeta{ID: "bar", ResourceVersion: uint64(2)}}
|
||||
|
||||
fakeWatch := watch.NewFake()
|
||||
fakeClient := &client.Fake{Watch: fakeWatch}
|
||||
@@ -72,13 +72,13 @@ func TestServices(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServicesFromZero(t *testing.T) {
|
||||
service := api.Service{JSONBase: api.JSONBase{ID: "bar", ResourceVersion: uint64(2)}}
|
||||
service := api.Service{TypeMeta: api.TypeMeta{ID: "bar", ResourceVersion: uint64(2)}}
|
||||
|
||||
fakeWatch := watch.NewFake()
|
||||
fakeWatch.Stop()
|
||||
fakeClient := &client.Fake{Watch: fakeWatch}
|
||||
fakeClient.ServiceList = api.ServiceList{
|
||||
JSONBase: api.JSONBase{ResourceVersion: 2},
|
||||
TypeMeta: api.TypeMeta{ResourceVersion: 2},
|
||||
Items: []api.Service{
|
||||
service,
|
||||
},
|
||||
@@ -152,7 +152,7 @@ func TestServicesFromZeroError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEndpoints(t *testing.T) {
|
||||
endpoint := api.Endpoints{JSONBase: api.JSONBase{ID: "bar", ResourceVersion: uint64(2)}, Endpoints: []string{"127.0.0.1:9000"}}
|
||||
endpoint := api.Endpoints{TypeMeta: api.TypeMeta{ID: "bar", ResourceVersion: uint64(2)}, Endpoints: []string{"127.0.0.1:9000"}}
|
||||
|
||||
fakeWatch := watch.NewFake()
|
||||
fakeClient := &client.Fake{Watch: fakeWatch}
|
||||
@@ -197,13 +197,13 @@ func TestEndpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEndpointsFromZero(t *testing.T) {
|
||||
endpoint := api.Endpoints{JSONBase: api.JSONBase{ID: "bar", ResourceVersion: uint64(2)}, Endpoints: []string{"127.0.0.1:9000"}}
|
||||
endpoint := api.Endpoints{TypeMeta: api.TypeMeta{ID: "bar", ResourceVersion: uint64(2)}, Endpoints: []string{"127.0.0.1:9000"}}
|
||||
|
||||
fakeWatch := watch.NewFake()
|
||||
fakeWatch.Stop()
|
||||
fakeClient := &client.Fake{Watch: fakeWatch}
|
||||
fakeClient.EndpointsList = api.EndpointsList{
|
||||
JSONBase: api.JSONBase{ResourceVersion: 2},
|
||||
TypeMeta: api.TypeMeta{ResourceVersion: 2},
|
||||
Items: []api.Endpoints{
|
||||
endpoint,
|
||||
},
|
||||
|
@@ -45,7 +45,7 @@ func (s sortedServices) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
func (s sortedServices) Less(i, j int) bool {
|
||||
return s[i].JSONBase.ID < s[j].JSONBase.ID
|
||||
return s[i].TypeMeta.ID < s[j].TypeMeta.ID
|
||||
}
|
||||
|
||||
type ServiceHandlerMock struct {
|
||||
@@ -136,7 +136,7 @@ func TestNewServiceAddedAndNotified(t *testing.T) {
|
||||
handler := NewServiceHandlerMock()
|
||||
handler.Wait(1)
|
||||
config.RegisterHandler(handler)
|
||||
serviceUpdate := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "foo"}, Port: 10})
|
||||
serviceUpdate := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "foo"}, Port: 10})
|
||||
channel <- serviceUpdate
|
||||
handler.ValidateServices(t, serviceUpdate.Services)
|
||||
|
||||
@@ -147,24 +147,24 @@ func TestServiceAddedRemovedSetAndNotified(t *testing.T) {
|
||||
channel := config.Channel("one")
|
||||
handler := NewServiceHandlerMock()
|
||||
config.RegisterHandler(handler)
|
||||
serviceUpdate := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "foo"}, Port: 10})
|
||||
serviceUpdate := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "foo"}, Port: 10})
|
||||
handler.Wait(1)
|
||||
channel <- serviceUpdate
|
||||
handler.ValidateServices(t, serviceUpdate.Services)
|
||||
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "bar"}, Port: 20})
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "bar"}, Port: 20})
|
||||
handler.Wait(1)
|
||||
channel <- serviceUpdate2
|
||||
services := []api.Service{serviceUpdate2.Services[0], serviceUpdate.Services[0]}
|
||||
handler.ValidateServices(t, services)
|
||||
|
||||
serviceUpdate3 := CreateServiceUpdate(REMOVE, api.Service{JSONBase: api.JSONBase{ID: "foo"}})
|
||||
serviceUpdate3 := CreateServiceUpdate(REMOVE, api.Service{TypeMeta: api.TypeMeta{ID: "foo"}})
|
||||
handler.Wait(1)
|
||||
channel <- serviceUpdate3
|
||||
services = []api.Service{serviceUpdate2.Services[0]}
|
||||
handler.ValidateServices(t, services)
|
||||
|
||||
serviceUpdate4 := CreateServiceUpdate(SET, api.Service{JSONBase: api.JSONBase{ID: "foobar"}, Port: 99})
|
||||
serviceUpdate4 := CreateServiceUpdate(SET, api.Service{TypeMeta: api.TypeMeta{ID: "foobar"}, Port: 99})
|
||||
handler.Wait(1)
|
||||
channel <- serviceUpdate4
|
||||
services = []api.Service{serviceUpdate4.Services[0]}
|
||||
@@ -180,8 +180,8 @@ func TestNewMultipleSourcesServicesAddedAndNotified(t *testing.T) {
|
||||
}
|
||||
handler := NewServiceHandlerMock()
|
||||
config.RegisterHandler(handler)
|
||||
serviceUpdate1 := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "foo"}, Port: 10})
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "bar"}, Port: 20})
|
||||
serviceUpdate1 := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "foo"}, Port: 10})
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "bar"}, Port: 20})
|
||||
handler.Wait(2)
|
||||
channelOne <- serviceUpdate1
|
||||
channelTwo <- serviceUpdate2
|
||||
@@ -197,8 +197,8 @@ func TestNewMultipleSourcesServicesMultipleHandlersAddedAndNotified(t *testing.T
|
||||
handler2 := NewServiceHandlerMock()
|
||||
config.RegisterHandler(handler)
|
||||
config.RegisterHandler(handler2)
|
||||
serviceUpdate1 := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "foo"}, Port: 10})
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{JSONBase: api.JSONBase{ID: "bar"}, Port: 20})
|
||||
serviceUpdate1 := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "foo"}, Port: 10})
|
||||
serviceUpdate2 := CreateServiceUpdate(ADD, api.Service{TypeMeta: api.TypeMeta{ID: "bar"}, Port: 20})
|
||||
handler.Wait(2)
|
||||
handler2.Wait(2)
|
||||
channelOne <- serviceUpdate1
|
||||
@@ -217,11 +217,11 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddedAndNotified(t *testing.
|
||||
config.RegisterHandler(handler)
|
||||
config.RegisterHandler(handler2)
|
||||
endpointsUpdate1 := CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint1", "endpoint2"},
|
||||
})
|
||||
endpointsUpdate2 := CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "bar"},
|
||||
TypeMeta: api.TypeMeta{ID: "bar"},
|
||||
Endpoints: []string{"endpoint3", "endpoint4"},
|
||||
})
|
||||
handler.Wait(2)
|
||||
@@ -243,11 +243,11 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
|
||||
config.RegisterHandler(handler)
|
||||
config.RegisterHandler(handler2)
|
||||
endpointsUpdate1 := CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint1", "endpoint2"},
|
||||
})
|
||||
endpointsUpdate2 := CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "bar"},
|
||||
TypeMeta: api.TypeMeta{ID: "bar"},
|
||||
Endpoints: []string{"endpoint3", "endpoint4"},
|
||||
})
|
||||
handler.Wait(2)
|
||||
@@ -261,7 +261,7 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
|
||||
|
||||
// Add one more
|
||||
endpointsUpdate3 := CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foobar"},
|
||||
TypeMeta: api.TypeMeta{ID: "foobar"},
|
||||
Endpoints: []string{"endpoint5", "endpoint6"},
|
||||
})
|
||||
handler.Wait(1)
|
||||
@@ -273,7 +273,7 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
|
||||
|
||||
// Update the "foo" service with new endpoints
|
||||
endpointsUpdate1 = CreateEndpointsUpdate(ADD, api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint77"},
|
||||
})
|
||||
handler.Wait(1)
|
||||
@@ -284,7 +284,7 @@ func TestNewMultipleSourcesEndpointsMultipleHandlersAddRemoveSetAndNotified(t *t
|
||||
handler2.ValidateEndpoints(t, endpoints)
|
||||
|
||||
// Remove "bar" service
|
||||
endpointsUpdate2 = CreateEndpointsUpdate(REMOVE, api.Endpoints{JSONBase: api.JSONBase{ID: "bar"}})
|
||||
endpointsUpdate2 = CreateEndpointsUpdate(REMOVE, api.Endpoints{TypeMeta: api.TypeMeta{ID: "bar"}})
|
||||
handler.Wait(1)
|
||||
handler2.Wait(1)
|
||||
channelTwo <- endpointsUpdate2
|
||||
|
@@ -221,7 +221,7 @@ func (s ConfigSourceEtcd) ProcessChange(response *etcd.Response) {
|
||||
parts := strings.Split(response.Node.Key[1:], "/")
|
||||
if len(parts) == 4 {
|
||||
glog.V(4).Infof("Deleting service: %s", parts[3])
|
||||
serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{{JSONBase: api.JSONBase{ID: parts[3]}}}}
|
||||
serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{{TypeMeta: api.TypeMeta{ID: parts[3]}}}}
|
||||
s.serviceChannel <- serviceUpdate
|
||||
return
|
||||
}
|
||||
|
@@ -111,8 +111,8 @@ func (s ConfigSourceFile) Run() {
|
||||
newServices := make([]api.Service, len(config.Services))
|
||||
newEndpoints := make([]api.Endpoints, len(config.Services))
|
||||
for i, service := range config.Services {
|
||||
newServices[i] = api.Service{JSONBase: api.JSONBase{ID: service.Name}, Port: service.Port}
|
||||
newEndpoints[i] = api.Endpoints{JSONBase: api.JSONBase{ID: service.Name}, Endpoints: service.Endpoints}
|
||||
newServices[i] = api.Service{TypeMeta: api.TypeMeta{ID: service.Name}, Port: service.Port}
|
||||
newEndpoints[i] = api.Endpoints{TypeMeta: api.TypeMeta{ID: service.Name}, Endpoints: service.Endpoints}
|
||||
}
|
||||
if !reflect.DeepEqual(lastServices, newServices) {
|
||||
serviceUpdate := ServiceUpdate{Op: SET, Services: newServices}
|
||||
|
@@ -139,7 +139,7 @@ func TestTCPProxy(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", tcpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -157,7 +157,7 @@ func TestUDPProxy(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", udpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -184,7 +184,7 @@ func TestTCPProxyStop(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", tcpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -212,7 +212,7 @@ func TestUDPProxyStop(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", udpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -240,7 +240,7 @@ func TestTCPProxyUpdateDelete(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", tcpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -267,7 +267,7 @@ func TestUDPProxyUpdateDelete(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", udpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -294,7 +294,7 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", tcpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -317,7 +317,7 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
|
||||
}
|
||||
proxyPortNum, _ := strconv.Atoi(proxyPort)
|
||||
p.OnUpdate([]api.Service{
|
||||
{JSONBase: api.JSONBase{ID: "echo"}, Port: proxyPortNum, Protocol: "TCP"},
|
||||
{TypeMeta: api.TypeMeta{ID: "echo"}, Port: proxyPortNum, Protocol: "TCP"},
|
||||
})
|
||||
testEchoTCP(t, "127.0.0.1", proxyPort)
|
||||
}
|
||||
@@ -326,7 +326,7 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", udpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -349,7 +349,7 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
|
||||
}
|
||||
proxyPortNum, _ := strconv.Atoi(proxyPort)
|
||||
p.OnUpdate([]api.Service{
|
||||
{JSONBase: api.JSONBase{ID: "echo"}, Port: proxyPortNum, Protocol: "UDP"},
|
||||
{TypeMeta: api.TypeMeta{ID: "echo"}, Port: proxyPortNum, Protocol: "UDP"},
|
||||
})
|
||||
testEchoUDP(t, "127.0.0.1", proxyPort)
|
||||
}
|
||||
@@ -358,7 +358,7 @@ func TestTCPProxyUpdatePort(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", tcpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -384,7 +384,7 @@ func TestTCPProxyUpdatePort(t *testing.T) {
|
||||
t.Errorf("expected difference, got %s %s", newPort, proxyPort)
|
||||
}
|
||||
p.OnUpdate([]api.Service{
|
||||
{JSONBase: api.JSONBase{ID: "echo"}, Port: newPortNum, Protocol: "TCP"},
|
||||
{TypeMeta: api.TypeMeta{ID: "echo"}, Port: newPortNum, Protocol: "TCP"},
|
||||
})
|
||||
if err := waitForClosedPortTCP(p, proxyPort); err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
@@ -403,7 +403,7 @@ func TestUDPProxyUpdatePort(t *testing.T) {
|
||||
lb := NewLoadBalancerRR()
|
||||
lb.OnUpdate([]api.Endpoints{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "echo"},
|
||||
TypeMeta: api.TypeMeta{ID: "echo"},
|
||||
Endpoints: []string{net.JoinHostPort("127.0.0.1", udpServerPort)},
|
||||
},
|
||||
})
|
||||
@@ -429,7 +429,7 @@ func TestUDPProxyUpdatePort(t *testing.T) {
|
||||
t.Errorf("expected difference, got %s %s", newPort, proxyPort)
|
||||
}
|
||||
p.OnUpdate([]api.Service{
|
||||
{JSONBase: api.JSONBase{ID: "echo"}, Port: newPortNum, Protocol: "UDP"},
|
||||
{TypeMeta: api.TypeMeta{ID: "echo"}, Port: newPortNum, Protocol: "UDP"},
|
||||
})
|
||||
if err := waitForClosedPortUDP(p, proxyPort); err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
|
@@ -86,7 +86,7 @@ func TestLoadBalanceWorksWithSingleEndpoint(t *testing.T) {
|
||||
}
|
||||
endpoints := make([]api.Endpoints, 1)
|
||||
endpoints[0] = api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint1:40"},
|
||||
}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
@@ -104,7 +104,7 @@ func TestLoadBalanceWorksWithMultipleEndpoints(t *testing.T) {
|
||||
}
|
||||
endpoints := make([]api.Endpoints, 1)
|
||||
endpoints[0] = api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint:1", "endpoint:2", "endpoint:3"},
|
||||
}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
@@ -122,7 +122,7 @@ func TestLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) {
|
||||
}
|
||||
endpoints := make([]api.Endpoints, 1)
|
||||
endpoints[0] = api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint:1", "endpoint:2", "endpoint:3"},
|
||||
}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
@@ -133,7 +133,7 @@ func TestLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) {
|
||||
expectEndpoint(t, loadBalancer, "foo", "endpoint:2")
|
||||
// Then update the configuration with one fewer endpoints, make sure
|
||||
// we start in the beginning again
|
||||
endpoints[0] = api.Endpoints{JSONBase: api.JSONBase{ID: "foo"},
|
||||
endpoints[0] = api.Endpoints{TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint:8", "endpoint:9"},
|
||||
}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
@@ -142,7 +142,7 @@ func TestLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) {
|
||||
expectEndpoint(t, loadBalancer, "foo", "endpoint:8")
|
||||
expectEndpoint(t, loadBalancer, "foo", "endpoint:9")
|
||||
// Clear endpoints
|
||||
endpoints[0] = api.Endpoints{JSONBase: api.JSONBase{ID: "foo"}, Endpoints: []string{}}
|
||||
endpoints[0] = api.Endpoints{TypeMeta: api.TypeMeta{ID: "foo"}, Endpoints: []string{}}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
|
||||
endpoint, err = loadBalancer.NextEndpoint("foo", nil)
|
||||
@@ -159,11 +159,11 @@ func TestLoadBalanceWorksWithServiceRemoval(t *testing.T) {
|
||||
}
|
||||
endpoints := make([]api.Endpoints, 2)
|
||||
endpoints[0] = api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Endpoints: []string{"endpoint:1", "endpoint:2", "endpoint:3"},
|
||||
}
|
||||
endpoints[1] = api.Endpoints{
|
||||
JSONBase: api.JSONBase{ID: "bar"},
|
||||
TypeMeta: api.TypeMeta{ID: "bar"},
|
||||
Endpoints: []string{"endpoint:4", "endpoint:5"},
|
||||
}
|
||||
loadBalancer.OnUpdate(endpoints)
|
||||
|
Reference in New Issue
Block a user