@@ -209,6 +209,57 @@ func TestGetProviderSpecificCloudflareAnnotations(t *testing.T) {
209
209
t .Errorf ("Cloudflare provider specific annotation %s is not set correctly to %v" , tc .expectedKey , tc .expectedValue )
210
210
})
211
211
}
212
+
213
+ for _ , tc := range []struct {
214
+ title string
215
+ annotations map [string ]string
216
+ expectedKey string
217
+ expectedValue string
218
+ }{
219
+ {
220
+ title : "Cloudflare comment is set" ,
221
+ annotations : map [string ]string {CloudflareRecordCommentKey : "test" },
222
+ expectedKey : CloudflareRecordCommentKey ,
223
+ expectedValue : "test" ,
224
+ },
225
+ {
226
+ title : "Cloudflare comment is set among other annotations" ,
227
+ annotations : map [string ]string {
228
+ "random annotation 1" : "random value 1" ,
229
+ CloudflareRecordCommentKey : "test" ,
230
+ "random annotation 2" : "random value 2" ,
231
+ },
232
+ expectedKey : CloudflareRecordCommentKey ,
233
+ expectedValue : "test" ,
234
+ },
235
+ {
236
+ title : "Cloudflare tags are set" ,
237
+ annotations : map [string ]string {CloudflareRecordTagsKey : "test1,test2" },
238
+ expectedKey : CloudflareRecordTagsKey ,
239
+ expectedValue : "test1,test2" ,
240
+ },
241
+ {
242
+ title : "Cloudflare tags are set among other annotations" ,
243
+ annotations : map [string ]string {
244
+ "random annotation 1" : "random value 1" ,
245
+ CloudflareRecordTagsKey : "test1,test2" ,
246
+ "random annotation 2" : "random value 2" ,
247
+ },
248
+ expectedKey : CloudflareRecordTagsKey ,
249
+ expectedValue : "test1,test2" ,
250
+ },
251
+ } {
252
+ t .Run (tc .title , func (t * testing.T ) {
253
+ providerSpecificAnnotations , _ := getProviderSpecificAnnotations (tc .annotations )
254
+ for _ , providerSpecificAnnotation := range providerSpecificAnnotations {
255
+ if providerSpecificAnnotation .Name == tc .expectedKey {
256
+ assert .Equal (t , tc .expectedValue , providerSpecificAnnotation .Value )
257
+ return
258
+ }
259
+ }
260
+ t .Errorf ("Cloudflare provider specific annotation %s is not set correctly to %v" , tc .expectedKey , tc .expectedValue )
261
+ })
262
+ }
212
263
}
213
264
214
265
func TestGetProviderSpecificAliasAnnotations (t * testing.T ) {
0 commit comments