diff --git a/docs/_providers/name.com.md b/docs/_providers/name.com.md index 06d3d8b8d..4d26a6e99 100644 --- a/docs/_providers/name.com.md +++ b/docs/_providers/name.com.md @@ -40,7 +40,7 @@ Example javascript (Registrar only. DNS hosted elsewhere): {% highlight js %} var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM"); -var R53 = NewDnsProvider("r53", ROUTE53); +var R53 = NewDnsProvider("r53", "ROUTE53"); D("example.tld", REG_NAMECOM, DnsProvider(R53), A("test","1.2.3.4") diff --git a/docs/_providers/namecheap.md b/docs/_providers/namecheap.md index 10d7761a3..04ef46d3b 100644 --- a/docs/_providers/namecheap.md +++ b/docs/_providers/namecheap.md @@ -49,7 +49,7 @@ Example javascript: {% highlight js %} var namecheap = NewRegistrar("namecheap.com","NAMECHEAP"); -var R53 = NewDnsProvider("r53", ROUTE53); +var R53 = NewDnsProvider("r53", "ROUTE53"); D("example.tld", namecheap, DnsProvider(R53), A("test","1.2.3.4") diff --git a/docs/_providers/route53.md b/docs/_providers/route53.md index 8ede43b76..46839454e 100644 --- a/docs/_providers/route53.md +++ b/docs/_providers/route53.md @@ -7,7 +7,7 @@ jsId: ROUTE53 ## Configuration -By default, you can configure aws setting like the [go sdk configuration](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html). For example you can use environment variables: +By default, you can configure aws setting like the [go sdk configuration](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html). For example you can use environment variables: ``` $ export AWS_ACCESS_KEY_ID=XXXXXXXXX $ export AWS_SECRET_ACCESS_KEY=YYYYYYYYY @@ -34,7 +34,7 @@ Example javascript: {% highlight js %} var REG_NAMECOM = NewRegistrar("name.com","NAMEDOTCOM"); -var R53 = NewDnsProvider("r53", ROUTE53); +var R53 = NewDnsProvider("r53", "ROUTE53"); D("example.tld", REG_NAMECOM, DnsProvider(R53), A("test","1.2.3.4") @@ -47,7 +47,7 @@ DNSControl depends on a standard [aws access key](https://aws.amazon.com/develop ## New domains -If a domain does not exist in your Route53 account, DNSControl +If a domain does not exist in your Route53 account, DNSControl will *not* automatically add it. You can do that either manually via the control panel, or via the command `dnscontrol create-domains` command. diff --git a/docs/index.md b/docs/index.md index 214225285..0e994f7e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,10 +11,12 @@ Dnscontrol is a platform for seamlessly managing your dns configuration across a ## [Language Reference]({{site.github.url}}/js): Description of the DNSControl language (DSL). -## [Examples]({{site.github.url}}/examples): DSL examples. +## [Examples]({{site.github.url}}/examples): The DNSControl language by example. ## [Migrating]({{site.github.url}}/migrating): Migrating zones to DNSControl. +## [Testing]({{site.github.url}}/unittests): Unit Testing DNS Data. + ## [github](https://github.com/StackExchange/dnscontrol): Get the source! diff --git a/docs/unittests.md b/docs/unittests.md new file mode 100644 index 000000000..5023aeeb8 --- /dev/null +++ b/docs/unittests.md @@ -0,0 +1,33 @@ +# Unit Testing DNS Data + +## Testing + +DNSControl performs a number of tests during the validation stage. +You can find them in `pkg/normalize/validate.go`. + + +## External tests + +Tests specific to your environment may be added as external tests. +Output the intermediate representation as a JSON file and perform +tests on this data. + +Output the intermediate representation: + + dnscontrol -debugjson foo.json print + +Here is a sample test written in `bash` using the [jq](https://stedolan.github.io/jq/) command. This fails if the number of MX records in the `stackex.com` domain is not exactly 5: + + COUNTMX=$(jq --raw-output