github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/integrationTest/readme.md (about)

     1  ### Integration Tests
     2  
     3  This is a simple framework for testing dns providers by making real requests.
     4  
     5  There is a sequence of changes that are defined in the test file that are run against your chosen provider.
     6  
     7  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.
     8  
     9  ## Configuration
    10  
    11  `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.
    12  
    13  ## Running a test
    14  
    15  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](https://github.com/jsonmaur/zoo) to run my commands. 
    16  2. run `go test -v -provider $NAME` where $NAME is the name of the provider you wish to run. 
    17  
    18  Example:
    19  
    20  ```
    21  $ egrep R53 providers.json 
    22      "KeyId": "$R53_KEY_ID",
    23      "SecretKey": "$R53_KEY",
    24      "domain": "$R53_DOMAIN"
    25  $ export R53_KEY_ID="redacted"
    26  $ export R53_KEY="also redacted"
    27  $ export R53_DOMAIN="testdomain.tld"
    28  $ go test -v -verbose -provider ROUTE53
    29  ```
    30  
    31  WARNING: The records in the test domain will be deleted.  Only use
    32  a domain that is not used in production. Some providers have a way
    33  to run tests on domains that aren't registered (often a test
    34  environment or a side-effect of the company not being a registrar).
    35  In other cases we use a domain we squat on, or we register a domain
    36  called `dnscontrol-$provider.com` just for testing.
    37  
    38  ProTip: If you run these tests frequently (and we hope you do), you
    39  should create a script that you can `source` to set these
    40  variables. Be careful not to check this script into Git since it
    41  contains credentials.