1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NETCUP: Adopt diff2 in compatibility mode (#1895)

This commit is contained in:
Tom Limoncelli
2023-01-18 12:34:45 -05:00
committed by GitHub
parent 9bb38c4526
commit 572f2ce28c
2 changed files with 48 additions and 44 deletions

View File

@@ -693,6 +693,11 @@ func makeTests(t *testing.T) []*TestGroup {
tc("Change it", a("@", "1.2.3.4")), tc("Change it", a("@", "1.2.3.4")),
tc("Add another", a("@", "1.2.3.4"), a("www", "1.2.3.4")), tc("Add another", a("@", "1.2.3.4"), a("www", "1.2.3.4")),
tc("Add another(same name)", a("@", "1.2.3.4"), a("www", "1.2.3.4"), a("www", "5.6.7.8")), tc("Add another(same name)", a("@", "1.2.3.4"), a("www", "1.2.3.4"), a("www", "5.6.7.8")),
),
testgroup("Protocol-TTL",
not("NETCUP"), // NETCUP does not support TTLs.
tc("Start", a("@", "1.2.3.4"), a("www", "1.2.3.4"), a("www", "5.6.7.8")),
tc("Change a ttl", ttl(a("@", "1.2.3.4"), 1000), a("www", "1.2.3.4"), a("www", "5.6.7.8")), tc("Change a ttl", ttl(a("@", "1.2.3.4"), 1000), a("www", "1.2.3.4"), a("www", "5.6.7.8")),
tc("Change single target from set", ttl(a("@", "1.2.3.4"), 1000), a("www", "2.2.2.2"), a("www", "5.6.7.8")), tc("Change single target from set", ttl(a("@", "1.2.3.4"), 1000), a("www", "2.2.2.2"), a("www", "5.6.7.8")),
tc("Change all ttls", ttl(a("@", "1.2.3.4"), 500), ttl(a("www", "2.2.2.2"), 400), ttl(a("www", "5.6.7.8"), 400)), tc("Change all ttls", ttl(a("@", "1.2.3.4"), 500), ttl(a("www", "2.2.2.2"), 400), ttl(a("www", "5.6.7.8"), 400)),

View File

@@ -102,10 +102,14 @@ func (api *netcupProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
// txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records // txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
var corrections []*models.Correction var corrections []*models.Correction
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives var create, del, modify diff.Changeset
if !diff2.EnableDiff2 {
differ := diff.New(dc) differ := diff.New(dc)
_, create, del, modify, err := differ.IncrementalDiff(existingRecords) _, create, del, modify, err = differ.IncrementalDiff(existingRecords)
} else {
differ := diff.NewCompat(dc)
_, create, del, modify, err = differ.IncrementalDiff(existingRecords)
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -145,10 +149,5 @@ func (api *netcupProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
corrections = append(corrections, corr) corrections = append(corrections, corr)
} }
return corrections, nil
}
// Insert Future diff2 version here.
return corrections, nil return corrections, nil
} }