Skip to content

Commit

Permalink
Update docs on running single tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wyardley committed Jan 18, 2025
1 parent 5b7326c commit 257596c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/content/code-review/create-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 >}}
Expand All @@ -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 >}}
Expand Down
6 changes: 3 additions & 3 deletions docs/content/test/run-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ 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.
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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 257596c

Please sign in to comment.