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:
@@ -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
18
pkg/rejectif/mx.go
Normal 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
17
pkg/rejectif/srv.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user