Skip to content

Commit

Permalink
Add checks for non-migration case (#75)
Browse files Browse the repository at this point in the history
* check for no migration case
* fix non-migration test with unsupported plugin to expect no error

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

---------

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
  • Loading branch information
chrisohaver committed Feb 24, 2023
1 parent e45f0d5 commit 6438c4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions migration/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ import (
// any deprecated, removed, or ignored plugins/directives present in the Corefile. Notifications are also returned for
// any new default plugins that would be added in a migration.
func Deprecated(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) {
if fromCoreDNSVersion == toCoreDNSVersion {
return nil, nil
}
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, SevAll)
}

// Unsupported returns a list notifications of plugins/options that are not handled supported by this migration tool,
// but may still be valid in CoreDNS.
func Unsupported(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) {
if fromCoreDNSVersion == toCoreDNSVersion {
return nil, nil
}
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, SevUnsupported)
}

Expand Down
4 changes: 1 addition & 3 deletions migration/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,7 @@ func TestUnsupported(t *testing.T) {
`,
fromVersion: "1.3.1",
toVersion: "1.3.1",
expected: []Notice{
{Plugin: "route53", Severity: SevUnsupported, Version: "1.3.1"},
},
expected: []Notice{},
},
{
name: "Wrong plugin option",
Expand Down

0 comments on commit 6438c4f

Please sign in to comment.