aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/reverse_test.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2018-10-10 15:28:45 -0400
committerGravatar John Belamaric <jbelamaric@google.com> 2018-10-10 12:28:45 -0700
commit974ed086f25ad45a01947e276e2eb8aa73d007a3 (patch)
tree2c1468f5a4e90634382a81904ef2736ca44198a7 /plugin/kubernetes/reverse_test.go
parent8432f1420732e61cb1a7ebb9d6446db6f43aa850 (diff)
downloadcoredns-974ed086f25ad45a01947e276e2eb8aa73d007a3.tar.gz
coredns-974ed086f25ad45a01947e276e2eb8aa73d007a3.tar.zst
coredns-974ed086f25ad45a01947e276e2eb8aa73d007a3.zip
use keys (#2167)
Diffstat (limited to 'plugin/kubernetes/reverse_test.go')
-rw-r--r--plugin/kubernetes/reverse_test.go68
1 files changed, 31 insertions, 37 deletions
diff --git a/plugin/kubernetes/reverse_test.go b/plugin/kubernetes/reverse_test.go
index a706b7585..20c8496c7 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,38 +28,34 @@ func (APIConnReverseTest) SetWatchChan(watch.Chan) {}
func (APIConnReverseTest) Watch(string) error { return nil }
func (APIConnReverseTest) StopWatching(string) {}
-func (APIConnReverseTest) SvcIndex(svc string) []*object.Service {
- if svc != "svc1.testns" {
+func (APIConnReverseTest) SvcIndex(key string) *object.Service {
+ if key != "testns/svc1" {
return nil
}
- svcs := []*object.Service{
- {
- Name: "svc1",
- Namespace: "testns",
- ClusterIP: "192.168.1.100",
- Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}},
- },
+ svc := object.Service{
+ Name: "svc1",
+ Namespace: "testns",
+ ClusterIP: "192.168.1.100",
+ Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}},
}
- return svcs
+ return &svc
}
-func (APIConnReverseTest) SvcIndexReverse(ip string) []*object.Service {
+func (APIConnReverseTest) SvcIndexReverse(ip string) *object.Service {
if ip != "192.168.1.100" {
return nil
}
- svcs := []*object.Service{
- {
- Name: "svc1",
- Namespace: "testns",
- ClusterIP: "192.168.1.100",
- Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}},
- },
+ svc := object.Service{
+ Name: "svc1",
+ Namespace: "testns",
+ ClusterIP: "192.168.1.100",
+ Ports: []api.ServicePort{{Name: "http", Protocol: "tcp", Port: 80}},
}
- return svcs
+ return &svc
}
-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":
@@ -68,26 +64,24 @@ func (APIConnReverseTest) EpIndexReverse(ip string) []*object.Endpoints {
default:
return nil
}
- 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"},
- },
+ 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"},
},
},
- Name: "svc1",
- Namespace: "testns",
},
+ Name: "svc1",
+ Namespace: "testns",
}
- return eps
+ return &ep
}
func (APIConnReverseTest) GetNodeByName(name string) (*api.Node, error) {