hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

Running single acceptance test via make command #19934

Open wyardley opened 1 week ago

wyardley commented 1 week ago

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 commented 11 hours ago

maybe something like this?

'-run=\^TestAccBigtableTable_familyType\$$'