mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-09-20 06:46:19 +08:00
Cleanup SRV testing
* Integration tests: PTR tests should only happen if CanUsePTR * Integration tests: SRE tests should only happen if CanUseSRV * CanUseSRV should be validated early (in pkg/normalize/validate.go) * CLOUDFLARE does not support SRV. Check for this during validation * GCLOUD CanUsesRV (mostly by accident, but whatever works)
This commit is contained in:
parent
4bdaf37c78
commit
e6ce3b8895
|
@ -306,26 +306,26 @@ var tests = []*TestCase{
|
|||
tc("Change Preference", mx("@", 7, "foo2.com."), mx("mail", 15, "foo3.com.")),
|
||||
|
||||
//PTR
|
||||
tc("Empty"),
|
||||
tc("Create PTR record", ptr("4", "foo.com.")),
|
||||
tc("Modify PTR record", ptr("4", "bar.com.")),
|
||||
tc("Empty").IfHasCapability(providers.CanUsePTR),
|
||||
tc("Create PTR record", ptr("4", "foo.com.")).IfHasCapability(providers.CanUsePTR),
|
||||
tc("Modify PTR record", ptr("4", "bar.com.")).IfHasCapability(providers.CanUsePTR),
|
||||
|
||||
//ALIAS
|
||||
tc("Empty"),
|
||||
tc("Empty").IfHasCapability(providers.CanUseAlias),
|
||||
tc("ALIAS at root", alias("@", "foo.com.")).IfHasCapability(providers.CanUseAlias),
|
||||
tc("change it", alias("@", "foo2.com.")).IfHasCapability(providers.CanUseAlias),
|
||||
tc("ALIAS at subdomain", alias("test", "foo.com.")).IfHasCapability(providers.CanUseAlias),
|
||||
|
||||
//SRV
|
||||
tc("Empty"),
|
||||
tc("SRV record", srv("@", 5, 6, 7, "foo.com.")),
|
||||
tc("Second SRV record, same prio", srv("@", 5, 6, 7, "foo.com."), srv("@", 5, 60, 70, "foo2.com.")),
|
||||
tc("3 SRV", srv("@", 5, 6, 7, "foo.com."), srv("@", 5, 60, 70, "foo2.com."), srv("@", 15, 65, 75, "foo3.com.")),
|
||||
tc("Delete one", srv("@", 5, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo3.com.")),
|
||||
tc("Change Target", srv("@", 5, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")),
|
||||
tc("Change Priority", srv("@", 52, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")),
|
||||
tc("Change Weight", srv("@", 52, 62, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")),
|
||||
tc("Change Port", srv("@", 52, 62, 72, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")),
|
||||
tc("Empty").IfHasCapability(providers.CanUseSRV),
|
||||
tc("SRV record", srv("@", 5, 6, 7, "foo.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Second SRV record, same prio", srv("@", 5, 6, 7, "foo.com."), srv("@", 5, 60, 70, "foo2.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("3 SRV", srv("@", 5, 6, 7, "foo.com."), srv("@", 5, 60, 70, "foo2.com."), srv("@", 15, 65, 75, "foo3.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Delete one", srv("@", 5, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo3.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Change Target", srv("@", 5, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Change Priority", srv("@", 52, 6, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Change Weight", srv("@", 52, 62, 7, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
tc("Change Port", srv("@", 52, 62, 72, "foo.com."), srv("@", 15, 65, 75, "foo4.com.")).IfHasCapability(providers.CanUseSRV),
|
||||
|
||||
//TODO: in validation, check that everything is given in unicode. This case hurts too much.
|
||||
//tc("IDN pre-punycoded", cname("xn--o-0gab", "xn--o-0gab.xn--o-0gab.")),
|
||||
|
|
|
@ -356,6 +356,7 @@ func checkProviderCapabilities(dc *models.DomainConfig, pList []*models.DNSProvi
|
|||
}{
|
||||
{"ALIAS", providers.CanUseAlias},
|
||||
{"PTR", providers.CanUsePTR},
|
||||
{"SRV", providers.CanUseSRV},
|
||||
}
|
||||
for _, ty := range types {
|
||||
hasAny := false
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
providers.RegisterDomainServiceProviderType("GCLOUD", New, providers.CanUsePTR)
|
||||
providers.RegisterDomainServiceProviderType("GCLOUD", New, providers.CanUsePTR, providers.CanUseSRV)
|
||||
}
|
||||
|
||||
type gcloud struct {
|
||||
|
|
|
@ -41,6 +41,7 @@ type Capability uint32
|
|||
|
||||
const (
|
||||
// CanUseAlias indicates the provider support ALIAS records (or flattened CNAMES). Up to the provider to translate them to the appropriate record type.
|
||||
// If you add something to this list, you probably want to add it to pkg/normalize/validate.go checkProviderCapabilities() or somewhere near there.
|
||||
CanUseAlias Capability = 1 << iota
|
||||
// CanUsePTR indicates the provider can handle PTR records
|
||||
CanUsePTR
|
||||
|
|
Loading…
Reference in a new issue