We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
v1.6.0
During execution of tests in which an error occurs during an import, the failing test step number is not displayed in the CLI output.
For example, using the following test:
func TestTest_TestStep_ProviderFactories_Import_External(t *testing.T) { id := "none" t.Parallel() Test(t, TestCase{ ExternalProviders: map[string]ExternalProvider{ "random": { Source: "registry.terraform.io/hashicorp/random", }, }, Steps: []TestStep{ { Config: `resource "random_password" "test" { length = 12 }`, ResourceName: "random_password.test", ImportState: true, ImportStatePersist: true, ImportStateCheck: composeImportStateCheck( testCheckResourceAttrInstanceState(&id, "result", "Z=:cbrJE?Ltg"), testCheckResourceAttrInstanceState(&id, "length", "12"), ), }, }, }) }
Generates the following error, which does not indicate the failing test step number:
teststep_providers_test.go:2786: Resource specified by ResourceName couldn't be found: random_password.test
The test step number is present in the logs, re-running the same failing test with TF_LOG=TRACE generates the following output:
TF_LOG=TRACE
2024-02-02T11:04:20.405Z [TRACE] sdk.helper_resource: Using resource identifier for import identifier: test_name=TestTest_TestStep_ProviderFactories_Import_External test_terraform_path=/usr/local/bin/terraform test_working_directory=/var/folders/23/p8tx31c53rd16t1pjt03zndc0000gq/T/plugintest972934573 test_step_number=1 teststep_providers_test.go:2786: Resource specified by ResourceName couldn't be found: random_password.test
The log contains test_step_number=1.
Include the test step number in the error displayed by the CLI output.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
terraform-plugin-testing version
Use cases
During execution of tests in which an error occurs during an import, the failing test step number is not displayed in the CLI output.
For example, using the following test:
Generates the following error, which does not indicate the failing test step number:
teststep_providers_test.go:2786: Resource specified by ResourceName couldn't be found: random_password.test
Attempted solutions
The test step number is present in the logs, re-running the same failing test with
TF_LOG=TRACE
generates the following output:The log contains test_step_number=1.
Proposal
Include the test step number in the error displayed by the CLI output.
The text was updated successfully, but these errors were encountered: