aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/handler_test.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2017-09-29 15:58:50 -0400
committerGravatar John Belamaric <jbelamaric@infoblox.com> 2017-09-29 15:58:50 -0400
commit4b3a430ff2e6a39278eebd1493936c3a8a161fa0 (patch)
treea48c18346039c9b7808ec2395eeda49f8a0e1f0c /plugin/kubernetes/handler_test.go
parent45b0252c1aa3c9afb1951d4185644e23805167e5 (diff)
downloadcoredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.tar.gz
coredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.tar.zst
coredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.zip
plugin/kubernetes: Enable protobuf, Update client api package (#1114)
* vendor * code
Diffstat (limited to 'plugin/kubernetes/handler_test.go')
-rw-r--r--plugin/kubernetes/handler_test.go150
1 files changed, 74 insertions, 76 deletions
diff --git a/plugin/kubernetes/handler_test.go b/plugin/kubernetes/handler_test.go
index 1dd7ea621..388428e3a 100644
--- a/plugin/kubernetes/handler_test.go
+++ b/plugin/kubernetes/handler_test.go
@@ -8,7 +8,8 @@ import (
"github.com/miekg/dns"
"golang.org/x/net/context"
- "k8s.io/client-go/1.5/pkg/api"
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+ api "k8s.io/client-go/pkg/api/v1"
)
var dnsTestCases = []test.Case{
@@ -193,23 +194,22 @@ type APIConnServeTest struct{}
func (APIConnServeTest) Run() { return }
func (APIConnServeTest) Stop() error { return nil }
-func (APIConnServeTest) PodIndex(string) []interface{} {
- a := make([]interface{}, 1)
- a[0] = &api.Pod{
- ObjectMeta: api.ObjectMeta{
+func (APIConnServeTest) PodIndex(string) []*api.Pod {
+ a := []*api.Pod{{
+ ObjectMeta: meta.ObjectMeta{
Namespace: "podns",
},
Status: api.PodStatus{
PodIP: "10.240.0.1", // Remote IP set in test.ResponseWriter
},
- }
+ }}
return a
}
func (APIConnServeTest) ServiceList() []*api.Service {
svcs := []*api.Service{
{
- ObjectMeta: api.ObjectMeta{
+ ObjectMeta: meta.ObjectMeta{
Name: "svc1",
Namespace: "testns",
},
@@ -223,7 +223,7 @@ func (APIConnServeTest) ServiceList() []*api.Service {
},
},
{
- ObjectMeta: api.ObjectMeta{
+ ObjectMeta: meta.ObjectMeta{
Name: "hdls1",
Namespace: "testns",
},
@@ -232,7 +232,7 @@ func (APIConnServeTest) ServiceList() []*api.Service {
},
},
{
- ObjectMeta: api.ObjectMeta{
+ ObjectMeta: meta.ObjectMeta{
Name: "external",
Namespace: "testns",
},
@@ -247,100 +247,98 @@ func (APIConnServeTest) ServiceList() []*api.Service {
},
}
return svcs
-
}
-func (APIConnServeTest) EndpointsList() api.EndpointsList {
+func (APIConnServeTest) EndpointsList() []*api.Endpoints {
n := "test.node.foo.bar"
- return api.EndpointsList{
- Items: []api.Endpoints{
- {
- Subsets: []api.EndpointSubset{
- {
- Addresses: []api.EndpointAddress{
- {
- IP: "172.0.0.1",
- Hostname: "ep1a",
- },
+ eps := []*api.Endpoints{
+ {
+ Subsets: []api.EndpointSubset{
+ {
+ Addresses: []api.EndpointAddress{
+ {
+ IP: "172.0.0.1",
+ Hostname: "ep1a",
},
- Ports: []api.EndpointPort{
- {
- Port: 80,
- Protocol: "tcp",
- Name: "http",
- },
+ },
+ Ports: []api.EndpointPort{
+ {
+ Port: 80,
+ Protocol: "tcp",
+ Name: "http",
},
},
},
- ObjectMeta: api.ObjectMeta{
- Name: "svc1",
- Namespace: "testns",
- },
},
- {
- Subsets: []api.EndpointSubset{
- {
- Addresses: []api.EndpointAddress{
- {
- IP: "172.0.0.2",
- },
+ ObjectMeta: meta.ObjectMeta{
+ Name: "svc1",
+ Namespace: "testns",
+ },
+ },
+ {
+ Subsets: []api.EndpointSubset{
+ {
+ Addresses: []api.EndpointAddress{
+ {
+ IP: "172.0.0.2",
},
- Ports: []api.EndpointPort{
- {
- Port: 80,
- Protocol: "tcp",
- Name: "http",
- },
+ },
+ Ports: []api.EndpointPort{
+ {
+ Port: 80,
+ Protocol: "tcp",
+ Name: "http",
},
},
},
- ObjectMeta: api.ObjectMeta{
- Name: "hdls1",
- Namespace: "testns",
- },
},
- {
- Subsets: []api.EndpointSubset{
- {
- Addresses: []api.EndpointAddress{
- {
- IP: "172.0.0.3",
- },
+ ObjectMeta: meta.ObjectMeta{
+ Name: "hdls1",
+ Namespace: "testns",
+ },
+ },
+ {
+ Subsets: []api.EndpointSubset{
+ {
+ Addresses: []api.EndpointAddress{
+ {
+ IP: "172.0.0.3",
},
- Ports: []api.EndpointPort{
- {
- Port: 80,
- Protocol: "tcp",
- Name: "http",
- },
+ },
+ Ports: []api.EndpointPort{
+ {
+ Port: 80,
+ Protocol: "tcp",
+ Name: "http",
},
},
},
- ObjectMeta: api.ObjectMeta{
- Name: "hdls1",
- Namespace: "testns",
- },
},
- {
- Subsets: []api.EndpointSubset{
- {
- Addresses: []api.EndpointAddress{
- {
- IP: "10.9.8.7",
- NodeName: &n,
- },
+ ObjectMeta: meta.ObjectMeta{
+ Name: "hdls1",
+ Namespace: "testns",
+ },
+ },
+ {
+ Subsets: []api.EndpointSubset{
+ {
+ Addresses: []api.EndpointAddress{
+ {
+ IP: "10.9.8.7",
+ NodeName: &n,
},
},
},
},
},
}
+ return eps
}
-func (APIConnServeTest) GetNodeByName(name string) (api.Node, error) {
- return api.Node{
- ObjectMeta: api.ObjectMeta{
+func (APIConnServeTest) GetNodeByName(name string) (*api.Node, error) {
+ return &api.Node{
+ ObjectMeta: meta.ObjectMeta{
Name: "test.node.foo.bar",
},
}, nil