mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-05 17:16:59 +02:00
Add unit tests for NAPTR and invalid endpoints
This commit is contained in:
parent
b716b764af
commit
2fdc7354c0
@ -44,6 +44,8 @@ const (
|
||||
RecordTypePTR = "PTR"
|
||||
// RecordTypeMX is a RecordType enum value
|
||||
RecordTypeMX = "MX"
|
||||
// RecordTypeNAPTR is a RecordType enum value
|
||||
RecordTypeNAPTR = "NAPTR"
|
||||
)
|
||||
|
||||
// TTL is a structure defining the TTL of a DNS record
|
||||
|
@ -404,6 +404,69 @@ func testCRDSourceEndpoints(t *testing.T) {
|
||||
expectEndpoints: true,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
title: "Create NAPTR record",
|
||||
registeredAPIVersion: "test.k8s.io/v1alpha1",
|
||||
apiVersion: "test.k8s.io/v1alpha1",
|
||||
registeredKind: "DNSEndpoint",
|
||||
kind: "DNSEndpoint",
|
||||
namespace: "foo",
|
||||
registeredNamespace: "foo",
|
||||
labels: map[string]string{"test": "that"},
|
||||
labelFilter: "test=that",
|
||||
endpoints: []*endpoint.Endpoint{
|
||||
{
|
||||
DNSName: "example.org",
|
||||
Targets: endpoint.Targets{`100 10 "S" "SIP+D2U" "!^.*$!sip:customer-service@example.org!" _sip._udp.example.org.`, `102 10 "S" "SIP+D2T" "!^.*$!sip:customer-service@example.org!" _sip._tcp.example.org.`},
|
||||
RecordType: endpoint.RecordTypeNAPTR,
|
||||
RecordTTL: 180,
|
||||
},
|
||||
},
|
||||
expectEndpoints: true,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
title: "invalid endpoint CNAME",
|
||||
registeredAPIVersion: "test.k8s.io/v1alpha1",
|
||||
apiVersion: "test.k8s.io/v1alpha1",
|
||||
registeredKind: "DNSEndpoint",
|
||||
kind: "DNSEndpoint",
|
||||
namespace: "foo",
|
||||
registeredNamespace: "foo",
|
||||
labels: map[string]string{"test": "that"},
|
||||
labelFilter: "test=that",
|
||||
endpoints: []*endpoint.Endpoint{
|
||||
{
|
||||
DNSName: "example.org",
|
||||
Targets: endpoint.Targets{"foo.example.org."},
|
||||
RecordType: endpoint.RecordTypeCNAME,
|
||||
RecordTTL: 180,
|
||||
},
|
||||
},
|
||||
expectEndpoints: false,
|
||||
expectError: false,
|
||||
},
|
||||
{
|
||||
title: "invalid endpoint NAPTR",
|
||||
registeredAPIVersion: "test.k8s.io/v1alpha1",
|
||||
apiVersion: "test.k8s.io/v1alpha1",
|
||||
registeredKind: "DNSEndpoint",
|
||||
kind: "DNSEndpoint",
|
||||
namespace: "foo",
|
||||
registeredNamespace: "foo",
|
||||
labels: map[string]string{"test": "that"},
|
||||
labelFilter: "test=that",
|
||||
endpoints: []*endpoint.Endpoint{
|
||||
{
|
||||
DNSName: "example.org",
|
||||
Targets: endpoint.Targets{`100 10 "S" "SIP+D2U" "!^.*$!sip:customer-service@example.org!" _sip._udp.example.org`, `102 10 "S" "SIP+D2T" "!^.*$!sip:customer-service@example.org!" _sip._tcp.example.org`},
|
||||
RecordType: endpoint.RecordTypeNAPTR,
|
||||
RecordTTL: 180,
|
||||
},
|
||||
},
|
||||
expectEndpoints: false,
|
||||
expectError: false,
|
||||
},
|
||||
} {
|
||||
ti := ti
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user