Skip to content

Commit 6438c4f

Browse files
authored
Add checks for non-migration case (#75)
* check for no migration case * fix non-migration test with unsupported plugin to expect no error Signed-off-by: Chris O'Haver <[email protected]> --------- Signed-off-by: Chris O'Haver <[email protected]>
1 parent e45f0d5 commit 6438c4f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

migration/migrate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ import (
2020
// any deprecated, removed, or ignored plugins/directives present in the Corefile. Notifications are also returned for
2121
// any new default plugins that would be added in a migration.
2222
func Deprecated(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) {
23+
if fromCoreDNSVersion == toCoreDNSVersion {
24+
return nil, nil
25+
}
2326
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, SevAll)
2427
}
2528

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

migration/migrate_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,9 +858,7 @@ func TestUnsupported(t *testing.T) {
858858
`,
859859
fromVersion: "1.3.1",
860860
toVersion: "1.3.1",
861-
expected: []Notice{
862-
{Plugin: "route53", Severity: SevUnsupported, Version: "1.3.1"},
863-
},
861+
expected: []Notice{},
864862
},
865863
{
866864
name: "Wrong plugin option",

0 commit comments

Comments
 (0)