@@ -27,7 +27,6 @@ import (
2727type dnsManagerMock struct {
2828 addZoneRRSet func (ctx context.Context , zone , recordName , recordType string , values []gdns.ResourceRecord , ttl int ) error
2929 zonesWithRecords func (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error )
30- zones func (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error )
3130 deleteRRSetRecord func (ctx context.Context , zone , name , recordType string , contents ... string ) error
3231}
3332
@@ -39,9 +38,6 @@ func (d dnsManagerMock) AddZoneRRSet(ctx context.Context,
3938func (d dnsManagerMock ) ZonesWithRecords (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
4039 return d .zonesWithRecords (ctx , filters ... )
4140}
42- func (d dnsManagerMock ) Zones (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
43- return d .zones (ctx , filters ... )
44- }
4541func (d dnsManagerMock ) DeleteRRSetRecord (ctx context.Context , zone , name , recordType string , contents ... string ) error {
4642 return d .deleteRRSetRecord (ctx , zone , name , recordType , contents ... )
4743}
@@ -83,9 +79,6 @@ func Test_dnsProvider_Records(t *testing.T) {
8379 },
8480 }, nil
8581 },
86- zones : func (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
87- return []gdns.Zone {}, nil
88- },
8982 },
9083 dryRun : false ,
9184 },
@@ -105,34 +98,6 @@ func Test_dnsProvider_Records(t *testing.T) {
10598 client : dnsManagerMock {
10699 zonesWithRecords : func (ctx context.Context ,
107100 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
108- zoneFilter := & gdns.ZonesFilter {}
109- for _ , op := range filters {
110- op (zoneFilter )
111- }
112- val := []gdns.Zone {
113- {
114- Name : "example.com" ,
115- Records : []gdns.ZoneRecord {
116- {
117- Name : "test.example.com" ,
118- Type : "A" ,
119- TTL : 10 ,
120- ShortAnswers : []string {"1.1.1.1" },
121- },
122- },
123- },
124- }
125- res := make ([]gdns.Zone , 0 )
126- for _ , v := range val {
127- for _ , name := range zoneFilter .Names {
128- if name == v .Name {
129- res = append (res , v )
130- }
131- }
132- }
133- return res , nil
134- },
135- zones : func (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
136101 return []gdns.Zone {
137102 {
138103 Name : "example.com" ,
@@ -168,9 +133,6 @@ func Test_dnsProvider_Records(t *testing.T) {
168133 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
169134 return nil , fmt .Errorf ("test" )
170135 },
171- zones : func (ctx context.Context , filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
172- return []gdns.Zone {}, nil
173- },
174136 },
175137 dryRun : false ,
176138 },
@@ -223,7 +185,7 @@ func Test_dnsProvider_GetDomainFilter(t *testing.T) {
223185 fields : fields {
224186 domainFilter : endpoint.DomainFilter {},
225187 client : dnsManagerMock {
226- zones : func (ctx context.Context ,
188+ zonesWithRecords : func (ctx context.Context ,
227189 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
228190 return []gdns.Zone {{Name : "example.com" }}, nil
229191 },
@@ -237,7 +199,7 @@ func Test_dnsProvider_GetDomainFilter(t *testing.T) {
237199 fields : fields {
238200 domainFilter : endpoint.DomainFilter {},
239201 client : dnsManagerMock {
240- zones : func (ctx context.Context ,
202+ zonesWithRecords : func (ctx context.Context ,
241203 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
242204 return []gdns.Zone {}, nil
243205 },
@@ -282,7 +244,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
282244 fields : fields {
283245 domainFilter : endpoint.DomainFilter {},
284246 client : dnsManagerMock {
285- zones : func (ctx context.Context ,
247+ zonesWithRecords : func (ctx context.Context ,
286248 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
287249 return []gdns.Zone {{Name : "test.com" }}, nil
288250 },
@@ -310,7 +272,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
310272 fields : fields {
311273 domainFilter : endpoint.DomainFilter {},
312274 client : dnsManagerMock {
313- zones : func (ctx context.Context ,
275+ zonesWithRecords : func (ctx context.Context ,
314276 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
315277 return []gdns.Zone {{Name : "test.com" }}, nil
316278 },
@@ -338,7 +300,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
338300 fields : fields {
339301 domainFilter : endpoint.DomainFilter {},
340302 client : dnsManagerMock {
341- zones : func (ctx context.Context ,
303+ zonesWithRecords : func (ctx context.Context ,
342304 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
343305 return []gdns.Zone {{Name : "test.com" }}, nil
344306 },
@@ -360,7 +322,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
360322 fields : fields {
361323 domainFilter : endpoint.DomainFilter {},
362324 client : dnsManagerMock {
363- zones : func (ctx context.Context ,
325+ zonesWithRecords : func (ctx context.Context ,
364326 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
365327 return []gdns.Zone {{Name : "test.com" }}, nil
366328 },
@@ -388,7 +350,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
388350 fields : fields {
389351 domainFilter : endpoint.DomainFilter {},
390352 client : dnsManagerMock {
391- zones : func (ctx context.Context ,
353+ zonesWithRecords : func (ctx context.Context ,
392354 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
393355 return []gdns.Zone {{Name : "test.com" }}, nil
394356 },
@@ -420,7 +382,7 @@ func Test_dnsProvider_ApplyChanges(t *testing.T) {
420382 fields : fields {
421383 domainFilter : endpoint.DomainFilter {},
422384 client : dnsManagerMock {
423- zones : func (ctx context.Context ,
385+ zonesWithRecords : func (ctx context.Context ,
424386 filters ... func (zone * gdns.ZonesFilter )) ([]gdns.Zone , error ) {
425387 return []gdns.Zone {{Name : "test.com" }}, nil
426388 },
0 commit comments