From 257596c1b074bcc096a23641d62e1fe942e70f4a Mon Sep 17 00:00:00 2001 From: William Yardley Date: Fri, 17 Jan 2025 21:25:53 -0800 Subject: [PATCH] Update docs on running single tests The examples refer to running a single test, but the `-run` command example could potentially run lots of tests unexpectedly. Use a `-run=` example with the correct syntax for passing a literal dollar sign to the regex -- while the docs link to the golang docs, because of shell quoting and because of it getting passed via make, it seems to be necessary to use double dollar signs. Fixes hashicorp/terraform-provider-google#19934 --- docs/content/code-review/create-pr.md | 4 ++-- docs/content/test/run-tests.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content/code-review/create-pr.md b/docs/content/code-review/create-pr.md index 445fd848411a..89b78168d6ae 100644 --- a/docs/content/code-review/create-pr.md +++ b/docs/content/code-review/create-pr.md @@ -52,7 +52,7 @@ VCR test failures that do not immediately seem related to your PR are most likel git checkout modular-magician/auto-pr-PR_NUMBER make test make lint - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' + make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' ``` Replace PR_NUMBER with your PR's ID. {{< /tab >}} @@ -65,7 +65,7 @@ VCR test failures that do not immediately seem related to your PR are most likel git checkout modular-magician/auto-pr-PR_NUMBER make test make lint - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' + make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' ``` Replace PR_NUMBER with your PR's ID. {{< /tab >}} diff --git a/docs/content/test/run-tests.md b/docs/content/test/run-tests.md index 60ff14c06118..5c3c87bba5f9 100644 --- a/docs/content/test/run-tests.md +++ b/docs/content/test/run-tests.md @@ -60,7 +60,7 @@ aliases: 1. Run acceptance tests for only modified resources. (Full test runs can take over 9 hours.) See [Go's documentation](https://pkg.go.dev/cmd/go#hdr-Testing_flags) for more information about `-run` and other flags. ```bash - make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool' + make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' ``` > **Note:** Acceptance tests create actual infrastructure which can incur costs. Acceptance tests may not clean up after themselves if interrupted, so you may want to check for stray resources and / or billing charges. @@ -68,7 +68,7 @@ aliases: 1. Optional: Save verbose test output (including API requests and responses) to a file for analysis. ```bash - TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log + TF_LOG=DEBUG make testacc TEST=./google/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log ``` 1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags. @@ -100,7 +100,7 @@ aliases: 1. Optional: Save verbose test output to a file for analysis. ```bash - TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic' > output.log + TF_LOG=DEBUG make testacc TEST=./google-beta/services/container TESTARGS='-run=TestAccContainerNodePool_basic$$' > output.log ``` 1. Optional: Debug tests with [Delve](https://github.com/go-delve/delve). See [`dlv test` documentation](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_test.md) for information about available flags.