This commit is contained in:
Chris O'Haver
2018-10-10 15:28:45 -04:00
committed by John Belamaric
parent 8432f14207
commit 974ed086f2
13 changed files with 291 additions and 380 deletions

View File

@@ -16,22 +16,24 @@ type APIConnFederationTest struct {
func (APIConnFederationTest) HasSynced() bool { return true }
func (APIConnFederationTest) Run() { return }
func (APIConnFederationTest) Stop() error { return nil }
func (APIConnFederationTest) SvcIndexReverse(string) []*object.Service { return nil }
func (APIConnFederationTest) EpIndexReverse(string) []*object.Endpoints { return nil }
func (APIConnFederationTest) SvcIndexReverse(string) *object.Service { return nil }
func (APIConnFederationTest) EpIndexReverse(string) *object.Endpoints { return nil }
func (APIConnFederationTest) Modified() int64 { return 0 }
func (APIConnFederationTest) SetWatchChan(watch.Chan) {}
func (APIConnFederationTest) Watch(string) error { return nil }
func (APIConnFederationTest) StopWatching(string) {}
func (APIConnFederationTest) PodIndex(string) []*object.Pod {
return []*object.Pod{
{Namespace: "podns", PodIP: "10.240.0.1"}, // Remote IP set in test.ResponseWriter
}
}
func (APIConnFederationTest) SvcIndex(string) []*object.Service {
svcs := []*object.Service{
{
func (APIConnFederationTest) SvcIndex(key string) *object.Service {
svcs := map[string]*object.Service{
"testns/svc1": {
Name: "svc1",
Namespace: "testns",
ClusterIP: "10.0.0.1",
@@ -39,12 +41,12 @@ func (APIConnFederationTest) SvcIndex(string) []*object.Service {
{Name: "http", Protocol: "tcp", Port: 80},
},
},
{
"testns/hdls1": {
Name: "hdls1",
Namespace: "testns",
ClusterIP: api.ClusterIPNone,
},
{
"testns/external": {
Name: "external",
Namespace: "testns",
ExternalName: "ext.interwebs.test",
@@ -53,9 +55,10 @@ func (APIConnFederationTest) SvcIndex(string) []*object.Service {
},
},
}
return svcs
return svcs[key]
}
func (APIConnFederationTest) ServiceList() []*object.Service {
svcs := []*object.Service{
{
@@ -83,9 +86,9 @@ func (APIConnFederationTest) ServiceList() []*object.Service {
return svcs
}
func (APIConnFederationTest) EpIndex(string) []*object.Endpoints {
eps := []*object.Endpoints{
{
func (APIConnFederationTest) EpIndex(key string) *object.Endpoints {
eps := map[string]*object.Endpoints{
"testns/svc1": {
Subsets: []object.EndpointSubset{
{
Addresses: []object.EndpointAddress{
@@ -100,7 +103,7 @@ func (APIConnFederationTest) EpIndex(string) []*object.Endpoints {
Namespace: "testns",
},
}
return eps
return eps[key]
}
func (APIConnFederationTest) EndpointsList() []*object.Endpoints {