File tree 1 file changed +58
-2
lines changed
1 file changed +58
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ func TestIsLess(t *testing.T) {
153
153
}
154
154
}
155
155
156
- func TestFilterEndpointsByOwnerID (t * testing.T ) {
156
+ func TestFilterEndpointsByOwnerIDWithRecordTypeA (t * testing.T ) {
157
157
foo1 := & Endpoint {
158
158
DNSName : "foo.com" ,
159
159
RecordType : RecordTypeA ,
@@ -162,15 +162,71 @@ func TestFilterEndpointsByOwnerID(t *testing.T) {
162
162
},
163
163
}
164
164
foo2 := & Endpoint {
165
+ DNSName : "foo2.com" ,
166
+ RecordType : RecordTypeA ,
167
+ Labels : Labels {
168
+ OwnerLabelKey : "foo" ,
169
+ },
170
+ }
171
+ bar := & Endpoint {
172
+ DNSName : "foo.com" ,
173
+ RecordType : RecordTypeA ,
174
+ Labels : Labels {
175
+ OwnerLabelKey : "bar" ,
176
+ },
177
+ }
178
+ type args struct {
179
+ ownerID string
180
+ eps []* Endpoint
181
+ }
182
+ tests := []struct {
183
+ name string
184
+ args args
185
+ want []* Endpoint
186
+ }{
187
+ {
188
+ name : "filter values" ,
189
+ args : args {
190
+ ownerID : "foo" ,
191
+ eps : []* Endpoint {
192
+ foo1 ,
193
+ foo2 ,
194
+ bar ,
195
+ },
196
+ },
197
+ want : []* Endpoint {
198
+ foo1 ,
199
+ foo2 ,
200
+ },
201
+ },
202
+ }
203
+ for _ , tt := range tests {
204
+ t .Run (tt .name , func (t * testing.T ) {
205
+ if got := FilterEndpointsByOwnerID (tt .args .ownerID , tt .args .eps ); ! reflect .DeepEqual (got , tt .want ) {
206
+ t .Errorf ("ApplyEndpointFilter() = %v, want %v" , got , tt .want )
207
+ }
208
+ })
209
+ }
210
+ }
211
+
212
+ func TestFilterEndpointsByOwnerIDWithRecordTypeCNAME (t * testing.T ) {
213
+ foo1 := & Endpoint {
165
214
DNSName : "foo.com" ,
166
215
RecordType : RecordTypeCNAME ,
167
216
Labels : Labels {
168
217
OwnerLabelKey : "foo" ,
169
218
},
170
219
}
220
+ foo2 := & Endpoint {
221
+ DNSName : "foo2.com" ,
222
+ RecordType : RecordTypeCNAME ,
223
+ Labels : Labels {
224
+ OwnerLabelKey : "foo" ,
225
+ },
226
+ }
171
227
bar := & Endpoint {
172
228
DNSName : "foo.com" ,
173
- RecordType : RecordTypeA ,
229
+ RecordType : RecordTypeCNAME ,
174
230
Labels : Labels {
175
231
OwnerLabelKey : "bar" ,
176
232
},
You can’t perform that action at this time.
0 commit comments