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

DEV: Optimize integration tests (#1742)

This commit is contained in:
Tom Limoncelli
2022-09-07 14:08:06 -04:00
committed by GitHub
parent 4328c80335
commit 61e500b7dc
21 changed files with 286 additions and 311 deletions

View File

@@ -9,7 +9,25 @@ import (
// Keep these in alphabetical order.
// CaaTargetHasSemicolon audits CAA records for issues that contain semicolons.
// CaaFlagIsNonZero identifies CAA records where tag is no zero.
func CaaFlagIsNonZero(rc *models.RecordConfig) error {
if rc.CaaFlag != 0 {
return fmt.Errorf("caa flag is non-zero")
}
return nil
}
// CaaTargetContainsWhitespace identifies CAA records that have
// whitespace in the target.
// See https://github.com/StackExchange/dnscontrol/issues/1374
func CaaTargetContainsWhitespace(rc *models.RecordConfig) error {
if strings.ContainsAny(rc.GetTargetField(), " \t\r\n") {
return fmt.Errorf("caa target contains whitespace")
}
return nil
}
// CaaTargetHasSemicolon identifies CAA records that contain semicolons.
func CaaTargetHasSemicolon(rc *models.RecordConfig) error {
if strings.Contains(rc.GetTargetField(), ";") {
return fmt.Errorf("caa target contains semicolon")

18
pkg/rejectif/mx.go Normal file
View File

@@ -0,0 +1,18 @@
package rejectif
import (
"fmt"
"github.com/StackExchange/dnscontrol/v3/models"
)
// Keep these in alphabetical order.
// MxNull detects MX records that are a "null MX".
// This is needed by providers that don't support RFC 7505.
func MxNull(rc *models.RecordConfig) error {
if rc.GetTargetField() == "." {
return fmt.Errorf("mx has null target")
}
return nil
}

17
pkg/rejectif/srv.go Normal file
View File

@@ -0,0 +1,17 @@
package rejectif
import (
"fmt"
"github.com/StackExchange/dnscontrol/v3/models"
)
// Keep these in alphabetical order.
// SrvHasNullTarget detects SRV records that has a null target.
func SrvHasNullTarget(rc *models.RecordConfig) error {
if rc.GetTargetField() == "." {
return fmt.Errorf("srv has null target")
}
return nil
}