dnscontrol/integrationTest
Jaye Doepke 900d4042e8
ROUTE53: Adopt aws-sdk-go-v2 (#1321)
* Switch to aws-sdk-go-v2

AWS has released v2 of their SDK for Go.

See: https://aws.github.io/aws-sdk-go-v2/

One big advantage of this is no longer needing to export the
`AWS_SDK_LOAD_CONFIG=1` env var when using named profiles.

* Update integration test README

* Reenable pager601 and pager1201 integration tests for AWS Route53

* Implement intelligent batching for Route53 record changes

The AWS Route53 API for batch record changes limits the request size to
the smaller of:

- 1000 records.
- 32000 characters total for record values.

Also UPSERTs count as double (a DELETE and then a CREATE).

This commit changes how the record ChangeBatches are created to
respect these limits.

* Remove old comments

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
2021-12-07 16:29:29 -05:00
..
config Better .gitignore of integration test stuff. (#316) 2018-02-05 10:28:58 -05:00
zones Better .gitignore of integration test stuff. (#316) 2018-02-05 10:28:58 -05:00
integration_test.go ROUTE53: Adopt aws-sdk-go-v2 (#1321) 2021-12-07 16:29:29 -05:00
providers.json CLOUDFLAREAPI: Adds CF_WORKER_ROUTE (#1243) 2021-10-11 16:04:49 -04:00
readme.md ROUTE53: Adopt aws-sdk-go-v2 (#1321) 2021-12-07 16:29:29 -05:00

Integration Tests

This is a simple framework for testing dns providers by making real requests.

There is a sequence of changes that are defined in the test file that are run against your chosen provider.

For each step, it will run the config once and expect changes. It will run it again and expect no changes. This should give us much higher confidence that providers will work in real life.

Configuration

providers.json should have an object for each provider type under test. This is identical to the json expected in creds.json for dnscontrol, except it also has a "domain" field specified for the domain to test. The domain does not even need to be registered for most providers. Note that providers.json expects environment variables to be specified with the relevant info.

Running a test

  1. Define all environment variables expected for the provider you wish to run. I setup a local .env file with the appropriate values and use zoo to run my commands.
  2. run go test -v -provider $NAME where $NAME is the name of the provider you wish to run.

Example:

$ egrep ROUTE53 providers.json
    "KeyId": "$ROUTE53_KEY_ID",
    "SecretKey": "$ROUTE53_KEY",
    "domain": "$ROUTE53_DOMAIN"
$ export ROUTE53_KEY_ID="redacted"
$ export ROUTE53_KEY="also redacted"
$ export ROUTE53_DOMAIN="testdomain.tld"
$ go test -v -verbose -provider ROUTE53

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.

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.