@@ -25,83 +25,39 @@ import (
25
25
"github.com/stretchr/testify/assert"
26
26
)
27
27
28
- func TestZoneTypeFilterMatchAWS (t * testing.T ) {
29
- publicZone := & route53.HostedZone {Config : & route53.HostedZoneConfig {PrivateZone : aws .Bool (false )}}
30
- privateZone := & route53.HostedZone {Config : & route53.HostedZoneConfig {PrivateZone : aws .Bool (true )}}
31
-
32
- for _ , tc := range []struct {
33
- zoneTypeFilter string
34
- zone * route53.HostedZone
35
- matches bool
36
- }{
37
- {
38
- "" , publicZone , true ,
39
- },
40
- {
41
- "" , privateZone , true ,
42
- },
43
- {
44
- "public" , publicZone , true ,
45
- },
46
- {
47
- "public" , privateZone , false ,
48
- },
49
- {
50
- "private" , publicZone , false ,
51
- },
52
- {
53
- "private" , privateZone , true ,
54
- },
55
- {
56
- "unknown" , publicZone , false ,
57
- },
58
- {
59
- "" , & route53.HostedZone {}, true ,
60
- },
61
- {
62
- "public" , & route53.HostedZone {}, true ,
63
- },
64
- {
65
- "private" , & route53.HostedZone {}, false ,
66
- },
67
- } {
68
- zoneTypeFilter := NewZoneTypeFilter (tc .zoneTypeFilter )
69
- assert .Equal (t , tc .matches , zoneTypeFilter .Match (tc .zone ))
70
- }
71
- }
72
-
73
28
func TestZoneTypeFilterMatch (t * testing.T ) {
74
- publicZone := "public"
75
- privateZone := "private"
29
+ publicZoneStr := "public"
30
+ privateZoneStr := "private"
31
+ publicZoneAWS := & route53.HostedZone {Config : & route53.HostedZoneConfig {PrivateZone : aws .Bool (false )}}
32
+ privateZoneAWS := & route53.HostedZone {Config : & route53.HostedZoneConfig {PrivateZone : aws .Bool (true )}}
76
33
77
34
for _ , tc := range []struct {
78
35
zoneTypeFilter string
79
- zone string
80
36
matches bool
37
+ zones []interface {}
81
38
}{
82
39
{
83
- "" , publicZone , true ,
84
- },
85
- {
86
- "" , privateZone , true ,
40
+ "" , true , []interface {}{ publicZoneStr , privateZoneStr , & route53.HostedZone {} },
87
41
},
88
42
{
89
- "public" , publicZone , true ,
43
+ "public" , true , [] interface {}{ publicZoneStr , publicZoneAWS , & route53. HostedZone {} } ,
90
44
},
91
45
{
92
- "public" , privateZone , false ,
46
+ "public" , false , [] interface {}{ privateZoneStr , privateZoneAWS } ,
93
47
},
94
48
{
95
- "private" , publicZone , false ,
49
+ "private" , true , [] interface {}{ privateZoneStr , privateZoneAWS } ,
96
50
},
97
51
{
98
- "private" , privateZone , true ,
52
+ "private" , false , [] interface {}{ publicZoneStr , publicZoneAWS , & route53. HostedZone {} } ,
99
53
},
100
54
{
101
- "unknown" , publicZone , false ,
55
+ "unknown" , false , [] interface {}{ publicZoneStr } ,
102
56
},
103
57
} {
104
58
zoneTypeFilter := NewZoneTypeFilter (tc .zoneTypeFilter )
105
- assert .Equal (t , tc .matches , zoneTypeFilter .Match (tc .zone ))
59
+ for _ , zone := range tc .zones {
60
+ assert .Equal (t , tc .matches , zoneTypeFilter .Match (zone ))
61
+ }
106
62
}
107
63
}
0 commit comments