-
Notifications
You must be signed in to change notification settings - Fork 232
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
dev_overrides
in .terraformrc
appears to break acceptance tests (make testacc
/TF_ACC=1)
#1171
Comments
I have published the provider and found a bug in the code, which made things work for now, but I still think there is an underlying problem here. The code had a search-and-replace error in the update test for the resource, which became very apparent once I published the provider and got around the diff --git a/inventory/item_resource_test.go b/inventory/item_resource_test.go
index 43d4b41..3ccc54a 100644
--- a/inventory/item_resource_test.go
+++ b/inventory/item_resource_test.go
@@ -40,10 +40,10 @@ resource "inventory_item" "test" {
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
- resource.TestCheckResourceAttr("item_item.test", "name", "jet"),
- resource.TestCheckResourceAttr("item_item.test", "tag", "SR-71 Blackbird"),
+ resource.TestCheckResourceAttr("inventory_item.test", "name", "jet"),
+ resource.TestCheckResourceAttr("inventory_item.test", "tag", "SR-71 Blackbird"),
// Verify dynamic values have any value set in the state.
- resource.TestCheckResourceAttrSet("item_item.test", "id"),
+ resource.TestCheckResourceAttrSet("inventory_item.test", "id"),
),
},
// Delete testing automatically occurs in TestCase However, I am pretty sure that this was just a secondary issue and is not related to the failure that was occurring when the provider was unpublished. Now that it is published, I can not reproduce the error when |
Also, changing the
|
I'm running into the same issue like OP. For a use such as 'Create and Read testing' or 'Update and Read testing' one can get away setting |
Hi @spkane 👋 Thank you for raising this issue and sorry you ran into trouble here. From reading through this report, it appears that this issue is limited to functionality for acceptance testing providers, which in your case is being managed by the |
Now that this was transferred, some additional context -- The Terraform CLI This leaves the testing code in an awkward position here. Detecting whether a provider is being managed via The best recommendation for now I think would be to disable the usage of |
So, this is good to know. However, I am not sure that this completely resolves the issue. In the description, I also mention that Re-working my workflow to avoid using
Maybe this is caused by something else in the environment? |
Apologies if I misunderstood something about your report. One potential quirk with having an explicit: terraform {
required_providers {
inventory = {
source = "superorbital/inventory"
}
}
} In the test configuration, is that the testing code may require an additional I believe you can verify whether this is the case by enabling |
I am working on a currently unpublished Terraform provider. The source code is here, but it is not in the registry at the moment.
The provider works, but I have
dev_overrides
set in my.terraformrc
file this causes the acceptance tests for only the resource to fail, as the tests seem to try and run aterraform init
, which does not work whendev_overrides
are set.Module version
Relevant provider source code
main.go
provider_test.go
item_resource_test.go
Terraform Configuration Files
~/.terraformrc
Makefile
Debug Output
N/A
Expected Behavior
I expect the acceptance tests to work just fine with the local provider code, and to not complain about the provider not existing in the registry.
Actual Behavior
The tests appear to try to run
terraform init
which appears to cause issues in either case.dev_overerides
set. The data source test works, but the resource test fails (despite using the same terraform and provider block).dev_overerides
disabled. Neither test works.Steps to Reproduce
TF_ACC=1 go test -count=1 -parallel=4 -timeout 10m -v ./...
References
N/A
The text was updated successfully, but these errors were encountered: