@@ -404,6 +404,69 @@ func testCRDSourceEndpoints(t *testing.T) {
404
404
expectEndpoints : true ,
405
405
expectError : false ,
406
406
},
407
+ {
408
+ title : "Create NAPTR record" ,
409
+ registeredAPIVersion : "test.k8s.io/v1alpha1" ,
410
+ apiVersion : "test.k8s.io/v1alpha1" ,
411
+ registeredKind : "DNSEndpoint" ,
412
+ kind : "DNSEndpoint" ,
413
+ namespace : "foo" ,
414
+ registeredNamespace : "foo" ,
415
+ labels : map [string ]string {"test" : "that" },
416
+ labelFilter : "test=that" ,
417
+ endpoints : []* endpoint.Endpoint {
418
+ {
419
+ DNSName : "example.org" ,
420
+ 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.` },
421
+ RecordType : endpoint .RecordTypeNAPTR ,
422
+ RecordTTL : 180 ,
423
+ },
424
+ },
425
+ expectEndpoints : true ,
426
+ expectError : false ,
427
+ },
428
+ {
429
+ title : "illegal target CNAME" ,
430
+ registeredAPIVersion : "test.k8s.io/v1alpha1" ,
431
+ apiVersion : "test.k8s.io/v1alpha1" ,
432
+ registeredKind : "DNSEndpoint" ,
433
+ kind : "DNSEndpoint" ,
434
+ namespace : "foo" ,
435
+ registeredNamespace : "foo" ,
436
+ labels : map [string ]string {"test" : "that" },
437
+ labelFilter : "test=that" ,
438
+ endpoints : []* endpoint.Endpoint {
439
+ {
440
+ DNSName : "example.org" ,
441
+ Targets : endpoint.Targets {"foo.example.org." },
442
+ RecordType : endpoint .RecordTypeCNAME ,
443
+ RecordTTL : 180 ,
444
+ },
445
+ },
446
+ expectEndpoints : false ,
447
+ expectError : false ,
448
+ },
449
+ {
450
+ title : "illegal target NAPTR" ,
451
+ registeredAPIVersion : "test.k8s.io/v1alpha1" ,
452
+ apiVersion : "test.k8s.io/v1alpha1" ,
453
+ registeredKind : "DNSEndpoint" ,
454
+ kind : "DNSEndpoint" ,
455
+ namespace : "foo" ,
456
+ registeredNamespace : "foo" ,
457
+ labels : map [string ]string {"test" : "that" },
458
+ labelFilter : "test=that" ,
459
+ endpoints : []* endpoint.Endpoint {
460
+ {
461
+ DNSName : "example.org" ,
462
+ 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` },
463
+ RecordType : endpoint .RecordTypeNAPTR ,
464
+ RecordTTL : 180 ,
465
+ },
466
+ },
467
+ expectEndpoints : false ,
468
+ expectError : false ,
469
+ },
407
470
} {
408
471
ti := ti
409
472
t .Run (ti .title , func (t * testing.T ) {
0 commit comments