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

DOCS: Split out debugging / integration Tests (#2007)

This commit is contained in:
Jeffrey Cafferata
2023-01-28 17:07:32 +01:00
committed by GitHub
parent 833cddfbcd
commit f9be836e31
3 changed files with 33 additions and 20 deletions

View File

@ -152,6 +152,8 @@
* [Creating new DNS Resource Types (rtypes)](adding-new-rtypes.md)
* [TXT record testing](testing-txt-records.md)
* [Unit Testing DNS Data](unittests.md)
* [Integration Tests](integration-tests.md)
* [Debugging with dlv](debugging-with-dlv.md)
* [DNSControl is an opinionated system](opinions.md)
## Release

View File

@ -0,0 +1,15 @@
## Debugger
Test a particular function:
```shell
dlv test github.com/StackExchange/dnscontrol/v3/pkg/diff2 -- -test.run Test_analyzeByRecordSet
^^^^^^^^^
Assumes you are in the pkg/diff2 directory.
```
Debug the integration tests:
```shell
dlv test github.com/StackExchange/dnscontrol/v3/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -provider NAMEDOTCOM -start 1 -end 1 -diff2
```

View File

@ -17,42 +17,38 @@ For each step, it will run the config once and expect changes. It will run it ag
Example:
```bash
```shell
egrep ROUTE53 providers.json
```
```text
"KeyId": "$ROUTE53_KEY_ID",
"SecretKey": "$ROUTE53_KEY",
"domain": "$ROUTE53_DOMAIN"
```
```shell
export ROUTE53_KEY_ID="redacted"
export ROUTE53_KEY="also redacted"
export ROUTE53_DOMAIN="testdomain.tld"
```
```shell
go test -v -verbose -provider ROUTE53
```
WARNING: The records in the test domain will be deleted. Only use
{% hint style="warning" %}
**WARNING**: The records in the test domain will be deleted. Only use
a domain that is not used in production. Some providers have a way
to run tests on domains that aren't registered (often a test
environment or a side-effect of the company not being a registrar).
In other cases we use a domain we squat on, or we register a domain
called `dnscontrol-$provider.com` just for testing.
{% endhint %}
ProTip: If you run these tests frequently (and we hope you do), you
{% hint style="info" %}
**ProTip**: If you run these tests frequently (and we hope you do), you
should create a script that you can `source` to set these
variables. Be careful not to check this script into Git since it
contains credentials.
## Debugger
Test a particular function:
```
dlv test github.com/StackExchange/dnscontrol/v3/pkg/diff2 -- -test.run Test_analyzeByRecordSet
^^^^^^^^^
Assumes you are in the pkg/diff2 directory.
```
Debug the integration tests:
```
dlv test github.com/StackExchange/dnscontrol/v3/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -provider NAMEDOTCOM -start 1 -end 1 -diff2
```
{% endhint %}