mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
imp: improved test coverage from 66.7 to 100%
This commit is contained in:
parent
ad7dbb49ae
commit
ec8e95d262
@ -28,6 +28,11 @@ type zoneIDFilterTest struct {
|
||||
expected bool
|
||||
}
|
||||
|
||||
type zoneIdFilterTestIsConfigured struct {
|
||||
zoneIDFilter []string
|
||||
expected bool
|
||||
}
|
||||
|
||||
func TestZoneIDFilterMatch(t *testing.T) {
|
||||
zone := "/hostedzone/ZTST1"
|
||||
|
||||
@ -37,6 +42,11 @@ func TestZoneIDFilterMatch(t *testing.T) {
|
||||
zone,
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]string{""},
|
||||
zone,
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]string{"/hostedzone/ZTST1"},
|
||||
zone,
|
||||
@ -77,3 +87,31 @@ func TestZoneIDFilterMatch(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, zoneIDFilter.Match(tt.zone))
|
||||
}
|
||||
}
|
||||
|
||||
func TestZoneIDFilterIsConfigured(t *testing.T) {
|
||||
for _, tt := range []zoneIdFilterTestIsConfigured{
|
||||
{
|
||||
[]string{""},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]string{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]string{"/hostedzone/ZTST2"},
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]string{"/hostedzone/ZTST2", "hostedzone/ZTST2"},
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]string{"/ZSTS2"},
|
||||
true,
|
||||
},
|
||||
} {
|
||||
zoneIDFilter := NewZoneIDFilter(tt.zoneIDFilter)
|
||||
assert.Equal(t, tt.expected, zoneIDFilter.IsConfigured())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user