Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running single acceptance test via make command #19934

Closed
wyardley opened this issue Oct 19, 2024 · 2 comments · Fixed by GoogleCloudPlatform/magic-modules#12801, #21191 or hashicorp/terraform-provider-google-beta#9197
Labels

Comments

@wyardley
Copy link

Question

Using the example at https://googlecloudplatform.github.io/magic-modules/develop/test/run-tests/ and following the suggestion to use a regex to determine tests to run, running any of these:

$ make testacc TEST=./google/services/container  TESTARGS='-run=^TestAccContainerCluster_withNodeConfig$'
$ make testacc TEST=./google/services/container  TESTARGS='-run=TestAccContainerCluster_withNodeConfig'
make testacc TEST=./google/services/container  TESTARGS='--run ^TestAccContainerCluster_withNodeConfig$'

etc. seems to spin up all tests that match that glob pattern at all, globbing to

=== RUN   TestAccContainerCluster_withNodeConfigGcfsConfig
=== PAUSE TestAccContainerCluster_withNodeConfigGcfsConfig
=== RUN   TestAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates
=== PAUSE TestAccContainerCluster_withNodeConfigKubeletConfigSettingsUpdates

and so on

If I run the command that's running under the hood directly, with some slight tweaks:

$ TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/container/ -v --run '^TestAccContainerCluster_withNodeConfig$' -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"

it seems to behave how I want in this case (and runs the exact test only). Maybe this just needs a docs fix, or maybe make / shell is somehow expanding something internally?

@wyardley wyardley changed the title Running single test via make command Running single acceptance test via make command Oct 19, 2024
@wyardley
Copy link
Author

wyardley commented Oct 29, 2024

maybe something like this?

'-run=\^TestAccBigtableTable_familyType\$$'

(seems to work as best I can tell, though haven't done extensive testing)

@wyardley
Copy link
Author

Above seems to work fine for my use cases, though would be nice to see the docs fixed. 😉

wyardley added a commit to wyardley/magic-modules that referenced this issue Jan 18, 2025
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
wyardley added a commit to wyardley/magic-modules that referenced this issue Jan 26, 2025
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
wyardley added a commit to wyardley/magic-modules that referenced this issue Jan 30, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment