diff options
author | 2018-10-11 21:59:50 +0100 | |
---|---|---|
committer | 2018-10-11 16:59:50 -0400 | |
commit | 6ed88fab744bd3d8cc071153a4c78970798cf9e6 (patch) | |
tree | ab4935e8cb81931b65966ba13829f3f8780b12b3 /plugin/kubernetes/reverse_test.go | |
parent | c8fb66f8cc60ff17b916b033982c5491f23cdcc9 (diff) | |
download | coredns-6ed88fab744bd3d8cc071153a4c78970798cf9e6.tar.gz coredns-6ed88fab744bd3d8cc071153a4c78970798cf9e6.tar.zst coredns-6ed88fab744bd3d8cc071153a4c78970798cf9e6.zip |
Revert "use keys (#2167)" (#2188)
This reverts commit 974ed086f25ad45a01947e276e2eb8aa73d007a3.
Diffstat (limited to 'plugin/kubernetes/reverse_test.go')
-rw-r--r-- | plugin/kubernetes/reverse_test.go | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/plugin/kubernetes/reverse_test.go b/plugin/kubernetes/reverse_test.go index 20c8496c7..a706b7585 100644 --- a/plugin/kubernetes/reverse_test.go +++ b/plugin/kubernetes/reverse_test.go @@ -20,7 +20,7 @@ func (APIConnReverseTest) HasSynced() bool { return true } func (APIConnReverseTest) Run() { return } func (APIConnReverseTest) Stop() error { return nil } func (APIConnReverseTest) PodIndex(string) []*object.Pod { return nil } -func (APIConnReverseTest) EpIndex(string) *object.Endpoints { return nil } +func (APIConnReverseTest) EpIndex(string) []*object.Endpoints { return nil } func (APIConnReverseTest) EndpointsList() []*object.Endpoints { return nil } func (APIConnReverseTest) ServiceList() []*object.Service { return nil } func (APIConnReverseTest) Modified() int64 { return 0 } @@ -28,34 +28,38 @@ func (APIConnReverseTest) SetWatchChan(watch.Chan) {} func (APIConnReverseTest) Watch(string) error { return nil } func (APIConnReverseTest) StopWatching(string) {} -func (APIConnReverseTest) SvcIndex(key string) *object.Service { - if key != "testns/svc1" { +func (APIConnReverseTest) SvcIndex(svc string) []*object.Service { + if svc != "svc1.testns" { return nil } - svc := object.Service{ - Name: "svc1", - Namespace: "testns", - ClusterIP: "192.168.1.100", - Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}}, + svcs := []*object.Service{ + { + Name: "svc1", + Namespace: "testns", + ClusterIP: "192.168.1.100", + Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}}, + }, } - return &svc + return svcs } -func (APIConnReverseTest) SvcIndexReverse(ip string) *object.Service { +func (APIConnReverseTest) SvcIndexReverse(ip string) []*object.Service { if ip != "192.168.1.100" { return nil } - svc := object.Service{ - Name: "svc1", - Namespace: "testns", - ClusterIP: "192.168.1.100", - Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}}, + svcs := []*object.Service{ + { + Name: "svc1", + Namespace: "testns", + ClusterIP: "192.168.1.100", + Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}}, + }, } - return &svc + return svcs } -func (APIConnReverseTest) EpIndexReverse(ip string) *object.Endpoints { +func (APIConnReverseTest) EpIndexReverse(ip string) []*object.Endpoints { switch ip { case "10.0.0.100": case "1234:abcd::1": @@ -64,24 +68,26 @@ func (APIConnReverseTest) EpIndexReverse(ip string) *object.Endpoints { default: return nil } - ep := object.Endpoints{ - Subsets: []object.EndpointSubset{ - { - Addresses: []object.EndpointAddress{ - {IP: "10.0.0.100", Hostname: "ep1a"}, - {IP: "1234:abcd::1", Hostname: "ep1b"}, - {IP: "fd00:77:30::a", Hostname: "ip6svc1ex"}, - {IP: "fd00:77:30::2:9ba6", Hostname: "ip6svc1in"}, - }, - Ports: []object.EndpointPort{ - {Port: 80, Protocol: "tcp", Name: "http"}, + eps := []*object.Endpoints{ + { + Subsets: []object.EndpointSubset{ + { + Addresses: []object.EndpointAddress{ + {IP: "10.0.0.100", Hostname: "ep1a"}, + {IP: "1234:abcd::1", Hostname: "ep1b"}, + {IP: "fd00:77:30::a", Hostname: "ip6svc1ex"}, + {IP: "fd00:77:30::2:9ba6", Hostname: "ip6svc1in"}, + }, + Ports: []object.EndpointPort{ + {Port: 80, Protocol: "tcp", Name: "http"}, + }, }, }, + Name: "svc1", + Namespace: "testns", }, - Name: "svc1", - Namespace: "testns", } - return &ep + return eps } func (APIConnReverseTest) GetNodeByName(name string) (*api.Node, error) { |