@@ -62,7 +62,7 @@ func objBody(codec runtime.Encoder, obj runtime.Object) io.ReadCloser {
6262 return io .NopCloser (bytes .NewReader ([]byte (runtime .EncodeOrDie (codec , obj ))))
6363}
6464
65- func fakeRESTClient (endpoints []* endpoint .Endpoint , apiVersion , kind , namespace , name string , annotations map [string ]string , labels map [string ]string , _ * testing.T ) rest.Interface {
65+ func fakeRESTClient (endpoints []* apiv1alpha1 .Endpoint , apiVersion , kind , namespace , name string , annotations map [string ]string , labels map [string ]string , _ * testing.T ) rest.Interface {
6666 groupVersion , _ := schema .ParseGroupVersion (apiVersion )
6767 scheme := runtime .NewScheme ()
6868 _ = addKnownTypes (scheme , groupVersion )
@@ -143,7 +143,7 @@ func testCRDSourceEndpoints(t *testing.T) {
143143 apiVersion string
144144 registeredKind string
145145 kind string
146- endpoints []* endpoint .Endpoint
146+ endpoints []* apiv1alpha1 .Endpoint
147147 expectEndpoints bool
148148 expectError bool
149149 annotationFilter string
@@ -157,7 +157,7 @@ func testCRDSourceEndpoints(t *testing.T) {
157157 apiVersion : "blah.k8s.io/v1alpha1" ,
158158 registeredKind : "DNSEndpoint" ,
159159 kind : "DNSEndpoint" ,
160- endpoints : []* endpoint .Endpoint {
160+ endpoints : []* apiv1alpha1 .Endpoint {
161161 {
162162 DNSName : "abc.example.org" ,
163163 Targets : endpoint.Targets {"1.2.3.4" },
@@ -174,7 +174,7 @@ func testCRDSourceEndpoints(t *testing.T) {
174174 apiVersion : "test.k8s.io/v1alpha1" ,
175175 registeredKind : "DNSEndpoint" ,
176176 kind : "JustEndpoint" ,
177- endpoints : []* endpoint .Endpoint {
177+ endpoints : []* apiv1alpha1 .Endpoint {
178178 {
179179 DNSName : "abc.example.org" ,
180180 Targets : endpoint.Targets {"1.2.3.4" },
@@ -193,7 +193,7 @@ func testCRDSourceEndpoints(t *testing.T) {
193193 kind : "DNSEndpoint" ,
194194 namespace : "foo" ,
195195 registeredNamespace : "foo" ,
196- endpoints : []* endpoint .Endpoint {
196+ endpoints : []* apiv1alpha1 .Endpoint {
197197 {
198198 DNSName : "abc.example.org" ,
199199 Targets : endpoint.Targets {"1.2.3.4" },
@@ -212,7 +212,7 @@ func testCRDSourceEndpoints(t *testing.T) {
212212 kind : "DNSEndpoint" ,
213213 namespace : "foo" ,
214214 registeredNamespace : "bar" ,
215- endpoints : []* endpoint .Endpoint {
215+ endpoints : []* apiv1alpha1 .Endpoint {
216216 {
217217 DNSName : "abc.example.org" ,
218218 Targets : endpoint.Targets {"1.2.3.4" },
@@ -231,7 +231,7 @@ func testCRDSourceEndpoints(t *testing.T) {
231231 kind : "DNSEndpoint" ,
232232 namespace : "foo" ,
233233 registeredNamespace : "foo" ,
234- endpoints : []* endpoint .Endpoint {
234+ endpoints : []* apiv1alpha1 .Endpoint {
235235 {
236236 DNSName : "no-targets.example.org" ,
237237 Targets : endpoint.Targets {},
@@ -250,7 +250,7 @@ func testCRDSourceEndpoints(t *testing.T) {
250250 kind : "DNSEndpoint" ,
251251 namespace : "foo" ,
252252 registeredNamespace : "foo" ,
253- endpoints : []* endpoint .Endpoint {
253+ endpoints : []* apiv1alpha1 .Endpoint {
254254 {
255255 DNSName : "abc.example.org" ,
256256 Targets : endpoint.Targets {"1.2.3.4" },
@@ -269,7 +269,7 @@ func testCRDSourceEndpoints(t *testing.T) {
269269 kind : "DNSEndpoint" ,
270270 namespace : "foo" ,
271271 registeredNamespace : "foo" ,
272- endpoints : []* endpoint .Endpoint {
272+ endpoints : []* apiv1alpha1 .Endpoint {
273273 {
274274 DNSName : "abc.example.org" ,
275275 Targets : endpoint.Targets {"1.2.3.4" },
@@ -296,7 +296,7 @@ func testCRDSourceEndpoints(t *testing.T) {
296296 registeredNamespace : "foo" ,
297297 annotations : map [string ]string {"test" : "that" },
298298 annotationFilter : "test=filter_something_else" ,
299- endpoints : []* endpoint .Endpoint {
299+ endpoints : []* apiv1alpha1 .Endpoint {
300300 {
301301 DNSName : "abc.example.org" ,
302302 Targets : endpoint.Targets {"1.2.3.4" },
@@ -317,7 +317,7 @@ func testCRDSourceEndpoints(t *testing.T) {
317317 registeredNamespace : "foo" ,
318318 annotations : map [string ]string {"test" : "that" },
319319 annotationFilter : "test=that" ,
320- endpoints : []* endpoint .Endpoint {
320+ endpoints : []* apiv1alpha1 .Endpoint {
321321 {
322322 DNSName : "abc.example.org" ,
323323 Targets : endpoint.Targets {"1.2.3.4" },
@@ -338,7 +338,7 @@ func testCRDSourceEndpoints(t *testing.T) {
338338 registeredNamespace : "foo" ,
339339 labels : map [string ]string {"test" : "that" },
340340 labelFilter : "test=filter_something_else" ,
341- endpoints : []* endpoint .Endpoint {
341+ endpoints : []* apiv1alpha1 .Endpoint {
342342 {
343343 DNSName : "abc.example.org" ,
344344 Targets : endpoint.Targets {"1.2.3.4" },
@@ -359,7 +359,7 @@ func testCRDSourceEndpoints(t *testing.T) {
359359 registeredNamespace : "foo" ,
360360 labels : map [string ]string {"test" : "that" },
361361 labelFilter : "test=that" ,
362- endpoints : []* endpoint .Endpoint {
362+ endpoints : []* apiv1alpha1 .Endpoint {
363363 {
364364 DNSName : "abc.example.org" ,
365365 Targets : endpoint.Targets {"1.2.3.4" },
@@ -380,7 +380,7 @@ func testCRDSourceEndpoints(t *testing.T) {
380380 registeredNamespace : "foo" ,
381381 labels : map [string ]string {"test" : "that" },
382382 labelFilter : "test=that" ,
383- endpoints : []* endpoint .Endpoint {
383+ endpoints : []* apiv1alpha1 .Endpoint {
384384 {
385385 DNSName : "abc.example.org" ,
386386 Targets : endpoint.Targets {"ns1.k8s.io" , "ns2.k8s.io" },
@@ -401,7 +401,7 @@ func testCRDSourceEndpoints(t *testing.T) {
401401 registeredNamespace : "foo" ,
402402 labels : map [string ]string {"test" : "that" },
403403 labelFilter : "test=that" ,
404- endpoints : []* endpoint .Endpoint {
404+ endpoints : []* apiv1alpha1 .Endpoint {
405405 {
406406 DNSName : "_svc._tcp.example.org" ,
407407 Targets : endpoint.Targets {"0 0 80 abc.example.org" , "0 0 80 def.example.org" },
@@ -422,7 +422,7 @@ func testCRDSourceEndpoints(t *testing.T) {
422422 registeredNamespace : "foo" ,
423423 labels : map [string ]string {"test" : "that" },
424424 labelFilter : "test=that" ,
425- endpoints : []* endpoint .Endpoint {
425+ endpoints : []* apiv1alpha1 .Endpoint {
426426 {
427427 DNSName : "example.org" ,
428428 Targets : endpoint.
Targets {
`100 10 "S" "SIP+D2U" "!^.*$!sip:[email protected] !" _sip._udp.example.org.` ,
`102 10 "S" "SIP+D2T" "!^.*$!sip:[email protected] !" _sip._tcp.example.org.` },
@@ -443,7 +443,7 @@ func testCRDSourceEndpoints(t *testing.T) {
443443 registeredNamespace : "foo" ,
444444 labels : map [string ]string {"test" : "that" },
445445 labelFilter : "test=that" ,
446- endpoints : []* endpoint .Endpoint {
446+ endpoints : []* apiv1alpha1 .Endpoint {
447447 {
448448 DNSName : "example.org" ,
449449 Targets : endpoint.Targets {"foo.example.org." },
@@ -464,7 +464,7 @@ func testCRDSourceEndpoints(t *testing.T) {
464464 registeredNamespace : "foo" ,
465465 labels : map [string ]string {"test" : "that" },
466466 labelFilter : "test=that" ,
467- endpoints : []* endpoint .Endpoint {
467+ endpoints : []* apiv1alpha1 .Endpoint {
468468 {
469469 DNSName : "example.org" ,
470470 Targets : endpoint.
Targets {
`100 10 "S" "SIP+D2U" "!^.*$!sip:[email protected] !" _sip._udp.example.org` ,
`102 10 "S" "SIP+D2T" "!^.*$!sip:[email protected] !" _sip._tcp.example.org` },
@@ -513,7 +513,11 @@ func testCRDSourceEndpoints(t *testing.T) {
513513 }
514514
515515 // Validate received endpoints against expected endpoints.
516- validateEndpoints (t , receivedEndpoints , ti .endpoints )
516+ endpoints := make ([]* endpoint.Endpoint , 0 , len (ti .endpoints ))
517+ for _ , ep := range ti .endpoints {
518+ endpoints = append (endpoints , fromCRDEndpoint (ep ))
519+ }
520+ validateEndpoints (t , receivedEndpoints , endpoints )
517521
518522 for _ , e := range receivedEndpoints {
519523 // TODO: at the moment not all sources apply ResourceLabelKey
@@ -754,7 +758,7 @@ func generateTestFixtureDNSEndpointsByType(namespace string, typeCounts map[stri
754758 Namespace : namespace ,
755759 },
756760 Spec : apiv1alpha1.DNSEndpointSpec {
757- Endpoints : []* endpoint .Endpoint {
761+ Endpoints : []* apiv1alpha1 .Endpoint {
758762 {
759763 DNSName : strings .ToLower (fmt .Sprintf ("%s-%d.example.com" , rt , idx )),
760764 RecordType : rt ,
0 commit comments