@@ -66,7 +66,7 @@ func objBody(codec runtime.Encoder, obj runtime.Object) io.ReadCloser {
6666func fakeRESTClient (endpoints []* endpoint.Endpoint , apiVersion , kind , namespace , name string , annotations map [string ]string , labels map [string ]string , _ * testing.T ) rest.Interface {
6767 groupVersion , _ := schema .ParseGroupVersion (apiVersion )
6868 scheme := runtime .NewScheme ()
69- _ = addKnownTypes (scheme , groupVersion )
69+ _ = apiv1alpha1 . AddToScheme (scheme )
7070
7171 dnsEndpointList := apiv1alpha1.DNSEndpointList {}
7272 dnsEndpoint := & apiv1alpha1.DNSEndpoint {
@@ -171,9 +171,9 @@ func testCRDSourceEndpoints(t *testing.T) {
171171 },
172172 {
173173 title : "invalid crd kind" ,
174- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
175- apiVersion : "test.k8s.io/v1alpha1" ,
176- registeredKind : "DNSEndpoint" ,
174+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
175+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
176+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
177177 kind : "JustEndpoint" ,
178178 endpoints : []* endpoint.Endpoint {
179179 {
@@ -188,10 +188,10 @@ func testCRDSourceEndpoints(t *testing.T) {
188188 },
189189 {
190190 title : "endpoints within a specific namespace" ,
191- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
192- apiVersion : "test.k8s.io/v1alpha1" ,
193- registeredKind : "DNSEndpoint" ,
194- kind : "DNSEndpoint" ,
191+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
192+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
193+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
194+ kind : apiv1alpha1 . DNSEndpointKind ,
195195 namespace : "foo" ,
196196 registeredNamespace : "foo" ,
197197 endpoints : []* endpoint.Endpoint {
@@ -207,10 +207,10 @@ func testCRDSourceEndpoints(t *testing.T) {
207207 },
208208 {
209209 title : "no endpoints within a specific namespace" ,
210- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
211- apiVersion : "test.k8s.io/v1alpha1" ,
212- registeredKind : "DNSEndpoint" ,
213- kind : "DNSEndpoint" ,
210+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
211+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
212+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
213+ kind : apiv1alpha1 . DNSEndpointKind ,
214214 namespace : "foo" ,
215215 registeredNamespace : "bar" ,
216216 endpoints : []* endpoint.Endpoint {
@@ -226,10 +226,10 @@ func testCRDSourceEndpoints(t *testing.T) {
226226 },
227227 {
228228 title : "valid crd with no targets (relies on default-targets)" ,
229- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
230- apiVersion : "test.k8s.io/v1alpha1" ,
231- registeredKind : "DNSEndpoint" ,
232- kind : "DNSEndpoint" ,
229+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
230+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
231+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
232+ kind : apiv1alpha1 . DNSEndpointKind ,
233233 namespace : "foo" ,
234234 registeredNamespace : "foo" ,
235235 endpoints : []* endpoint.Endpoint {
@@ -245,10 +245,10 @@ func testCRDSourceEndpoints(t *testing.T) {
245245 },
246246 {
247247 title : "valid crd gvk with single endpoint" ,
248- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
249- apiVersion : "test.k8s.io/v1alpha1" ,
250- registeredKind : "DNSEndpoint" ,
251- kind : "DNSEndpoint" ,
248+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
249+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
250+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
251+ kind : apiv1alpha1 . DNSEndpointKind ,
252252 namespace : "foo" ,
253253 registeredNamespace : "foo" ,
254254 endpoints : []* endpoint.Endpoint {
@@ -264,10 +264,10 @@ func testCRDSourceEndpoints(t *testing.T) {
264264 },
265265 {
266266 title : "valid crd gvk with multiple endpoints" ,
267- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
268- apiVersion : "test.k8s.io/v1alpha1" ,
269- registeredKind : "DNSEndpoint" ,
270- kind : "DNSEndpoint" ,
267+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
268+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
269+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
270+ kind : apiv1alpha1 . DNSEndpointKind ,
271271 namespace : "foo" ,
272272 registeredNamespace : "foo" ,
273273 endpoints : []* endpoint.Endpoint {
@@ -289,10 +289,10 @@ func testCRDSourceEndpoints(t *testing.T) {
289289 },
290290 {
291291 title : "valid crd gvk with annotation and non matching annotation filter" ,
292- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
293- apiVersion : "test.k8s.io/v1alpha1" ,
294- registeredKind : "DNSEndpoint" ,
295- kind : "DNSEndpoint" ,
292+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
293+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
294+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
295+ kind : apiv1alpha1 . DNSEndpointKind ,
296296 namespace : "foo" ,
297297 registeredNamespace : "foo" ,
298298 annotations : map [string ]string {"test" : "that" },
@@ -310,10 +310,10 @@ func testCRDSourceEndpoints(t *testing.T) {
310310 },
311311 {
312312 title : "valid crd gvk with annotation and matching annotation filter" ,
313- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
314- apiVersion : "test.k8s.io/v1alpha1" ,
315- registeredKind : "DNSEndpoint" ,
316- kind : "DNSEndpoint" ,
313+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
314+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
315+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
316+ kind : apiv1alpha1 . DNSEndpointKind ,
317317 namespace : "foo" ,
318318 registeredNamespace : "foo" ,
319319 annotations : map [string ]string {"test" : "that" },
@@ -331,10 +331,10 @@ func testCRDSourceEndpoints(t *testing.T) {
331331 },
332332 {
333333 title : "valid crd gvk with label and non matching label filter" ,
334- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
335- apiVersion : "test.k8s.io/v1alpha1" ,
336- registeredKind : "DNSEndpoint" ,
337- kind : "DNSEndpoint" ,
334+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
335+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
336+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
337+ kind : apiv1alpha1 . DNSEndpointKind ,
338338 namespace : "foo" ,
339339 registeredNamespace : "foo" ,
340340 labels : map [string ]string {"test" : "that" },
@@ -352,10 +352,10 @@ func testCRDSourceEndpoints(t *testing.T) {
352352 },
353353 {
354354 title : "valid crd gvk with label and matching label filter" ,
355- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
356- apiVersion : "test.k8s.io/v1alpha1" ,
357- registeredKind : "DNSEndpoint" ,
358- kind : "DNSEndpoint" ,
355+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
356+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
357+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
358+ kind : apiv1alpha1 . DNSEndpointKind ,
359359 namespace : "foo" ,
360360 registeredNamespace : "foo" ,
361361 labels : map [string ]string {"test" : "that" },
@@ -373,10 +373,10 @@ func testCRDSourceEndpoints(t *testing.T) {
373373 },
374374 {
375375 title : "Create NS record" ,
376- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
377- apiVersion : "test.k8s.io/v1alpha1" ,
378- registeredKind : "DNSEndpoint" ,
379- kind : "DNSEndpoint" ,
376+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
377+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
378+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
379+ kind : apiv1alpha1 . DNSEndpointKind ,
380380 namespace : "foo" ,
381381 registeredNamespace : "foo" ,
382382 labels : map [string ]string {"test" : "that" },
@@ -394,10 +394,10 @@ func testCRDSourceEndpoints(t *testing.T) {
394394 },
395395 {
396396 title : "Create SRV record" ,
397- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
398- apiVersion : "test.k8s.io/v1alpha1" ,
399- registeredKind : "DNSEndpoint" ,
400- kind : "DNSEndpoint" ,
397+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
398+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
399+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
400+ kind : apiv1alpha1 . DNSEndpointKind ,
401401 namespace : "foo" ,
402402 registeredNamespace : "foo" ,
403403 labels : map [string ]string {"test" : "that" },
@@ -415,10 +415,10 @@ func testCRDSourceEndpoints(t *testing.T) {
415415 },
416416 {
417417 title : "Create NAPTR record" ,
418- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
419- apiVersion : "test.k8s.io/v1alpha1" ,
420- registeredKind : "DNSEndpoint" ,
421- kind : "DNSEndpoint" ,
418+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
419+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
420+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
421+ kind : apiv1alpha1 . DNSEndpointKind ,
422422 namespace : "foo" ,
423423 registeredNamespace : "foo" ,
424424 labels : map [string ]string {"test" : "that" },
@@ -436,10 +436,10 @@ func testCRDSourceEndpoints(t *testing.T) {
436436 },
437437 {
438438 title : "illegal target CNAME" ,
439- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
440- apiVersion : "test.k8s.io/v1alpha1" ,
441- registeredKind : "DNSEndpoint" ,
442- kind : "DNSEndpoint" ,
439+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
440+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
441+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
442+ kind : apiv1alpha1 . DNSEndpointKind ,
443443 namespace : "foo" ,
444444 registeredNamespace : "foo" ,
445445 labels : map [string ]string {"test" : "that" },
@@ -457,10 +457,10 @@ func testCRDSourceEndpoints(t *testing.T) {
457457 },
458458 {
459459 title : "illegal target NAPTR" ,
460- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
461- apiVersion : "test.k8s.io/v1alpha1" ,
462- registeredKind : "DNSEndpoint" ,
463- kind : "DNSEndpoint" ,
460+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
461+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
462+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
463+ kind : apiv1alpha1 . DNSEndpointKind ,
464464 namespace : "foo" ,
465465 registeredNamespace : "foo" ,
466466 labels : map [string ]string {"test" : "that" },
@@ -478,10 +478,10 @@ func testCRDSourceEndpoints(t *testing.T) {
478478 },
479479 {
480480 title : "valid target TXT" ,
481- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
482- apiVersion : "test.k8s.io/v1alpha1" ,
483- registeredKind : "DNSEndpoint" ,
484- kind : "DNSEndpoint" ,
481+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
482+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
483+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
484+ kind : apiv1alpha1 . DNSEndpointKind ,
485485 namespace : "foo" ,
486486 registeredNamespace : "foo" ,
487487 labels : map [string ]string {"test" : "that" },
@@ -499,10 +499,10 @@ func testCRDSourceEndpoints(t *testing.T) {
499499 },
500500 {
501501 title : "illegal target A" ,
502- registeredAPIVersion : "test.k8s.io/v1alpha1" ,
503- apiVersion : "test.k8s.io/v1alpha1" ,
504- registeredKind : "DNSEndpoint" ,
505- kind : "DNSEndpoint" ,
502+ registeredAPIVersion : apiv1alpha1 . GroupVersion . String () ,
503+ apiVersion : apiv1alpha1 . GroupVersion . String () ,
504+ registeredKind : apiv1alpha1 . DNSEndpointKind ,
505+ kind : apiv1alpha1 . DNSEndpointKind ,
506506 namespace : "foo" ,
507507 registeredNamespace : "foo" ,
508508 labels : map [string ]string {"test" : "that" },
@@ -528,7 +528,7 @@ func testCRDSourceEndpoints(t *testing.T) {
528528 require .NotNil (t , groupVersion )
529529
530530 scheme := runtime .NewScheme ()
531- err = addKnownTypes (scheme , groupVersion )
531+ err = apiv1alpha1 . AddToScheme (scheme )
532532 require .NoError (t , err )
533533
534534 labelSelector , err := labels .Parse (ti .labelFilter )
0 commit comments