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:
committed by
GitHub
parent
833cddfbcd
commit
f9be836e31
@ -152,6 +152,8 @@
|
|||||||
* [Creating new DNS Resource Types (rtypes)](adding-new-rtypes.md)
|
* [Creating new DNS Resource Types (rtypes)](adding-new-rtypes.md)
|
||||||
* [TXT record testing](testing-txt-records.md)
|
* [TXT record testing](testing-txt-records.md)
|
||||||
* [Unit Testing DNS Data](unittests.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)
|
* [DNSControl is an opinionated system](opinions.md)
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
|
15
documentation/debugging-with-dlv.md
Normal file
15
documentation/debugging-with-dlv.md
Normal 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
|
||||||
|
```
|
@ -17,42 +17,38 @@ For each step, it will run the config once and expect changes. It will run it ag
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
egrep ROUTE53 providers.json
|
egrep ROUTE53 providers.json
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
"KeyId": "$ROUTE53_KEY_ID",
|
"KeyId": "$ROUTE53_KEY_ID",
|
||||||
"SecretKey": "$ROUTE53_KEY",
|
"SecretKey": "$ROUTE53_KEY",
|
||||||
"domain": "$ROUTE53_DOMAIN"
|
"domain": "$ROUTE53_DOMAIN"
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
export ROUTE53_KEY_ID="redacted"
|
export ROUTE53_KEY_ID="redacted"
|
||||||
export ROUTE53_KEY="also redacted"
|
export ROUTE53_KEY="also redacted"
|
||||||
export ROUTE53_DOMAIN="testdomain.tld"
|
export ROUTE53_DOMAIN="testdomain.tld"
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
go test -v -verbose -provider ROUTE53
|
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
|
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
|
to run tests on domains that aren't registered (often a test
|
||||||
environment or a side-effect of the company not being a registrar).
|
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
|
In other cases we use a domain we squat on, or we register a domain
|
||||||
called `dnscontrol-$provider.com` just for testing.
|
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
|
should create a script that you can `source` to set these
|
||||||
variables. Be careful not to check this script into Git since it
|
variables. Be careful not to check this script into Git since it
|
||||||
contains credentials.
|
contains credentials.
|
||||||
|
{% endhint %}
|
||||||
## 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
|
|
||||||
```
|
|
Reference in New Issue
Block a user