mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
bugfix: add clarification to endpoint unit tests
This commit is contained in:
parent
93b831d81d
commit
08e917751b
@ -153,7 +153,7 @@ func TestIsLess(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterEndpointsByOwnerID(t *testing.T) {
|
func TestFilterEndpointsByOwnerIDWithRecordTypeA(t *testing.T) {
|
||||||
foo1 := &Endpoint{
|
foo1 := &Endpoint{
|
||||||
DNSName: "foo.com",
|
DNSName: "foo.com",
|
||||||
RecordType: RecordTypeA,
|
RecordType: RecordTypeA,
|
||||||
@ -162,8 +162,8 @@ func TestFilterEndpointsByOwnerID(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
foo2 := &Endpoint{
|
foo2 := &Endpoint{
|
||||||
DNSName: "foo.com",
|
DNSName: "foo2.com",
|
||||||
RecordType: RecordTypeCNAME,
|
RecordType: RecordTypeA,
|
||||||
Labels: Labels{
|
Labels: Labels{
|
||||||
OwnerLabelKey: "foo",
|
OwnerLabelKey: "foo",
|
||||||
},
|
},
|
||||||
@ -209,6 +209,62 @@ func TestFilterEndpointsByOwnerID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFilterEndpointsByOwnerIDWithRecordTypeCNAME(t *testing.T) {
|
||||||
|
foo1 := &Endpoint{
|
||||||
|
DNSName: "foo.com",
|
||||||
|
RecordType: RecordTypeCNAME,
|
||||||
|
Labels: Labels{
|
||||||
|
OwnerLabelKey: "foo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
foo2 := &Endpoint{
|
||||||
|
DNSName: "foo2.com",
|
||||||
|
RecordType: RecordTypeCNAME,
|
||||||
|
Labels: Labels{
|
||||||
|
OwnerLabelKey: "foo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
bar := &Endpoint{
|
||||||
|
DNSName: "foo.com",
|
||||||
|
RecordType: RecordTypeCNAME,
|
||||||
|
Labels: Labels{
|
||||||
|
OwnerLabelKey: "bar",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
type args struct {
|
||||||
|
ownerID string
|
||||||
|
eps []*Endpoint
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want []*Endpoint
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "filter values",
|
||||||
|
args: args{
|
||||||
|
ownerID: "foo",
|
||||||
|
eps: []*Endpoint{
|
||||||
|
foo1,
|
||||||
|
foo2,
|
||||||
|
bar,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: []*Endpoint{
|
||||||
|
foo1,
|
||||||
|
foo2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := FilterEndpointsByOwnerID(tt.args.ownerID, tt.args.eps); !reflect.DeepEqual(got, tt.want) {
|
||||||
|
t.Errorf("ApplyEndpointFilter() = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestIsOwnedBy(t *testing.T) {
|
func TestIsOwnedBy(t *testing.T) {
|
||||||
type fields struct {
|
type fields struct {
|
||||||
Labels Labels
|
Labels Labels
|
||||||
|
Loading…
Reference in New Issue
Block a user