diff --git a/pkg/normalize/validate.go b/pkg/normalize/validate.go index 057fe6f65..d7f66bd6b 100644 --- a/pkg/normalize/validate.go +++ b/pkg/normalize/validate.go @@ -103,7 +103,7 @@ func errorRepeat(label, domain string) string { ) } -func checkLabel(label string, rType string, target, domain string, meta map[string]string) error { +func checkLabel(label string, rType string, domain string, meta map[string]string) error { if label == "@" { return nil } @@ -142,7 +142,7 @@ func checkLabel(label string, rType string, target, domain string, meta map[stri return nil } -func checkSoa(expire uint32, minttl uint32, refresh uint32, retry uint32, serial uint32, mbox string) error { +func checkSoa(expire uint32, minttl uint32, refresh uint32, retry uint32, mbox string) error { if expire <= 0 { return fmt.Errorf("SOA Expire must be > 0") } @@ -213,7 +213,7 @@ func checkTargets(rec *models.RecordConfig, domain string) (errs []error) { case "PTR": check(checkTarget(target)) case "SOA": - check(checkSoa(rec.SoaExpire, rec.SoaMinttl, rec.SoaRefresh, rec.SoaRetry, rec.SoaSerial, rec.SoaMbox)) + check(checkSoa(rec.SoaExpire, rec.SoaMinttl, rec.SoaRefresh, rec.SoaRetry, rec.SoaMbox)) check(checkTarget(target)) if label != "@" { check(fmt.Errorf("SOA record is only valid for bare domain")) @@ -373,7 +373,7 @@ func ValidateAndNormalizeConfig(config *models.DNSConfig) (errs []error) { if err := validateRecordTypes(rec, domain.Name, pTypes); err != nil { errs = append(errs, err) } - if err := checkLabel(rec.GetLabel(), rec.Type, rec.GetTargetField(), domain.Name, rec.Metadata); err != nil { + if err := checkLabel(rec.GetLabel(), rec.Type, domain.Name, rec.Metadata); err != nil { errs = append(errs, err) } diff --git a/pkg/normalize/validate_test.go b/pkg/normalize/validate_test.go index dd6a51a0e..2de0f773e 100644 --- a/pkg/normalize/validate_test.go +++ b/pkg/normalize/validate_test.go @@ -41,35 +41,34 @@ func TestCheckSoa(t *testing.T) { minttl uint32 refresh uint32 retry uint32 - serial uint32 mbox string }{ // Expire - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, - {true, 0, 123, 123, 123, 123, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, + {true, 0, 123, 123, 123, "foo.bar.com."}, // MinTTL - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, - {true, 123, 0, 123, 123, 123, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, + {true, 123, 0, 123, 123, "foo.bar.com."}, // Refresh - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, - {true, 123, 123, 0, 123, 123, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, + {true, 123, 123, 0, 123, "foo.bar.com."}, // Retry - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, - {true, 123, 123, 123, 0, 123, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, + {true, 123, 123, 123, 0, "foo.bar.com."}, // Serial - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, - {false, 123, 123, 123, 123, 0, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, // MBox - {true, 123, 123, 123, 123, 123, ""}, - {true, 123, 123, 123, 123, 123, "foo@bar.com."}, - {false, 123, 123, 123, 123, 123, "foo.bar.com."}, + {true, 123, 123, 123, 123, ""}, + {true, 123, 123, 123, 123, "foo@bar.com."}, + {false, 123, 123, 123, 123, "foo.bar.com."}, } for _, test := range tests { - experiment := fmt.Sprintf("%d %d %d %d %d %s", test.expire, test.minttl, test.refresh, - test.retry, test.serial, test.mbox) + experiment := fmt.Sprintf("%d %d %d %d %s", test.expire, test.minttl, test.refresh, + test.retry, test.mbox) t.Run(experiment, func(t *testing.T) { - err := checkSoa(test.expire, test.minttl, test.refresh, test.retry, test.serial, test.mbox) + err := checkSoa(test.expire, test.minttl, test.refresh, test.retry, test.mbox) checkError(t, err, test.isError, experiment) }) } @@ -102,7 +101,7 @@ func TestCheckLabel(t *testing.T) { if test.hasSkipMeta { meta["skip_fqdn_check"] = "true" } - err := checkLabel(test.label, test.rType, test.target, "foo.tld", meta) + err := checkLabel(test.label, test.rType, "foo.tld", meta) if err != nil && !test.isError { t.Errorf("%02d: Expected no error but got %s", i, err) }