From 533c7e0946b326814dcdefbca9ac3b741383fc27 Mon Sep 17 00:00:00 2001 From: Jeffrey Cafferata Date: Sun, 5 Jan 2025 14:15:08 +0100 Subject: [PATCH] CHORE: Rename `-provider` to `-profile` within the documentation. --- documentation/adding-new-rtypes.md | 4 ++-- documentation/debugging-with-dlv.md | 2 +- documentation/integration-tests.md | 14 +++++++------- documentation/provider/cloudflareapi.md | 2 +- documentation/provider/cnr.md | 2 +- documentation/provider/hexonet.md | 2 +- documentation/test-a-branch.md | 2 +- documentation/writing-providers.md | 16 ++++++++-------- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/documentation/adding-new-rtypes.md b/documentation/adding-new-rtypes.md index acf054e03..895f3a071 100644 --- a/documentation/adding-new-rtypes.md +++ b/documentation/adding-new-rtypes.md @@ -253,7 +253,7 @@ To run the integration test with the BIND provider: ```shell cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider BIND +go test -v -verbose -profile BIND ``` Once the code works for BIND, consider submitting a PR at this point. @@ -276,7 +276,7 @@ export R53_DOMAIN=dnscontroltest-r53.com # Use a test domain. export R53_KEY_ID=CHANGE_TO_THE_ID export R53_KEY='CHANGE_TO_THE_KEY' cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider ROUTE53 +go test -v -verbose -profile ROUTE53 ``` The test should reveal any bugs. Keep iterating between fixing the diff --git a/documentation/debugging-with-dlv.md b/documentation/debugging-with-dlv.md index 750cd5b8f..7d1e2662b 100644 --- a/documentation/debugging-with-dlv.md +++ b/documentation/debugging-with-dlv.md @@ -11,5 +11,5 @@ dlv test github.com/StackExchange/dnscontrol/v4/pkg/diff2 -- -test.run Test_anal Debug the integration tests: ```shell -dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -provider NAMEDOTCOM -start 1 -end 1 -diff2 +dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -profile NAMEDOTCOM -start 1 -end 1 -diff2 ``` diff --git a/documentation/integration-tests.md b/documentation/integration-tests.md index 9fc6ff9fc..cbbebf7c1 100644 --- a/documentation/integration-tests.md +++ b/documentation/integration-tests.md @@ -14,7 +14,7 @@ For each step, it will run the config once and expect changes. It will run it ag 1. The integration tests need a test domain to run on. All the records of this domain will be deleted! 2. Define all environment variables expected for the provider you wish to run. -3. run `cd integrationTest && go test -v -provider $NAME` where $NAME is the name of the provider you wish to run. +3. run `cd integrationTest && go test -v -profile $NAME` where $NAME is the name of the provider you wish to run. Example: @@ -36,15 +36,15 @@ export ROUTE53_DOMAIN="testdomain.tld" ```shell cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider ROUTE53 +go test -v -verbose -profile ROUTE53 ``` The `-start` and `-end` flags allow you to run just a portion of the tests. ```shell -go test -v -verbose -provider ROUTE53 -start 16 -go test -v -verbose -provider ROUTE53 -end 5 -go test -v -verbose -provider ROUTE53 -start 16 -end 20 +go test -v -verbose -profile ROUTE53 -start 16 +go test -v -verbose -profile ROUTE53 -end 5 +go test -v -verbose -profile ROUTE53 -start 16 -end 20 ``` The `start` and `end` flags are both inclusive (i.e. `-start 16 -end 20` will run `[16, 17, 18, 19, 20]`). @@ -52,10 +52,10 @@ The `start` and `end` flags are both inclusive (i.e. `-start 16 -end 20` will ru For some providers it may be necessary to increase the test timeout using `-test`. The default is 10 minutes. `0` is "no limit". Typical Go durations work too (`1h` for 1 hour, etc). ```shell -go test -timeout 0 -v -verbose -provider CLOUDNS +go test -timeout 0 -v -verbose -profile CLOUDNS ``` -FYI: The order of the flags matters. Flags native to the Go testing suite (`-timeout` and `-v`) must come before flags that are part of the DNSControl integration tests (`-verbose`, `-provider`). Yeah, that sucks and is confusing. +FYI: The order of the flags matters. Flags native to the Go testing suite (`-timeout` and `-v`) must come before flags that are part of the DNSControl integration tests (`-verbose`, `-profile`). Yeah, that sucks and is confusing. The actual tests are in the file `integrationTest/integration_test.go`. The tests are in a little language which can be used to describe just about any diff --git a/documentation/provider/cloudflareapi.md b/documentation/provider/cloudflareapi.md index 48d47a116..370dd3fba 100644 --- a/documentation/provider/cloudflareapi.md +++ b/documentation/provider/cloudflareapi.md @@ -394,7 +394,7 @@ have access to read/edit Workers. This flag will eventually go away. ```shell cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider CLOUDFLAREAPI -cfworkers=false +go test -v -verbose -profile CLOUDFLAREAPI -cfworkers=false ``` When `-cfworkers=false` is set, tests related to Workers are skipped. The Account ID is not required. diff --git a/documentation/provider/cnr.md b/documentation/provider/cnr.md index a439fd04b..c673819f2 100644 --- a/documentation/provider/cnr.md +++ b/documentation/provider/cnr.md @@ -58,7 +58,7 @@ export CNR_ENTITY=OTE export CNR_UID=test.user export CNR_PW=test.passw0rd cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider CNR +go test -v -verbose -profile CNR ``` ## Usage diff --git a/documentation/provider/hexonet.md b/documentation/provider/hexonet.md index fe04a57a5..c944e3f30 100644 --- a/documentation/provider/hexonet.md +++ b/documentation/provider/hexonet.md @@ -62,7 +62,7 @@ export HEXONET_ENTITY=OTE export HEXONET_UID=test.user export HEXONET_PW=test.passw0rd cd integrationTest # NOTE: Not needed if already in that subdirectory -go test -v -verbose -provider HEXONET +go test -v -verbose -profile HEXONET ``` ## Usage diff --git a/documentation/test-a-branch.md b/documentation/test-a-branch.md index cd3f342d7..71c2e36e1 100644 --- a/documentation/test-a-branch.md +++ b/documentation/test-a-branch.md @@ -28,7 +28,7 @@ as usual. The directory to be in is `/go/dnscontrol/integrationTest`. ```shell cd /go/dnscontrol/integrationTest -go test -v -verbose -provider INSERT_PROVIDER_NAME -start 1 -end 3 +go test -v -verbose -profile INSERT_PROVIDER_NAME -start 1 -end 3 ``` Change `INSERT_PROVIDER_NAME` to the name of your provider (`BIND`, `ROUTE53`, `GCLOUD`, etc.) diff --git a/documentation/writing-providers.md b/documentation/writing-providers.md index 56c41b097..f9b17129a 100644 --- a/documentation/writing-providers.md +++ b/documentation/writing-providers.md @@ -173,7 +173,7 @@ For example, test BIND: ```shell cd integrationTest # NOTE: Not needed if already there export BIND_DOMAIN='example.com' -go test -v -verbose -provider BIND +go test -v -verbose -profile BIND ``` (BIND is a good place to start since it doesn't require API keys.) @@ -185,22 +185,22 @@ export R53_DOMAIN='dnscontroltest-r53.com' # Use a test domain. export R53_KEY_ID='CHANGE_TO_THE_ID' export R53_KEY='CHANGE_TO_THE_KEY' cd integrationTest # NOTE: Not needed if already there -go test -v -verbose -provider ROUTE53 +go test -v -verbose -profile ROUTE53 ``` Some useful `go test` flags: * Run only certain tests using the `-start` and `-end` flags. * Rather than running all the tests, run just the tests you want. - * These flags must be *after* the `-provider FOO` flag. - * Example: `go test -v -verbose -provider ROUTE53 -start 10 -end 20` run tests 10-20 inclusive. - * Example: `go test -v -verbose -provider ROUTE53 -start 5 -end 5` runs only test 5. - * Example: `go test -v -verbose -provider ROUTE53 -start 20` skip the first 19 tests. - * Example: `go test -v -verbose -provider ROUTE53 -end 20` only run the first 20 tests. + * These flags must be *after* the `-profile FOO` flag. + * Example: `go test -v -verbose -profile ROUTE53 -start 10 -end 20` run tests 10-20 inclusive. + * Example: `go test -v -verbose -profile ROUTE53 -start 5 -end 5` runs only test 5. + * Example: `go test -v -verbose -profile ROUTE53 -start 20` skip the first 19 tests. + * Example: `go test -v -verbose -profile ROUTE53 -end 20` only run the first 20 tests. * Slow tests? Add `-timeout n` to increase the timeout for tests * `go test` kills the tests after 10 minutes by default. Some providers need more time. * This flag must be *before* the `-verbose` flag. Usually it is the first flag after `go test`. - * Example: `go test -timeout 20m -v -verbose -provider CLOUDFLAREAPI` + * Example: `go test -timeout 20m -v -verbose -profile CLOUDFLAREAPI` * If a test will always fail because the provider doesn't support the feature, you can opt out of the test. Look at `func makeTests()` in [integrationTest/integration_test.go](https://github.com/StackExchange/dnscontrol/blob/2f65533e1b92c2967229a92a304fff7c14f7f4b6/integrationTest/integration_test.go#L675) for more details. ## Step 8: Manual tests