-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
VCR test(s) fail during replay: Framework converted resources #14158
VCR test(s) fail during replay: Framework converted resources #14158
Comments
It looked to me like none of the requests for these tests were being found during replay, so I wonder if the new framework is doing something different with requests, or possibly recording/replaying them differently. |
Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158.
…o identityplatform config (#8402) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158.
…o identityplatform config (hashicorp#8402) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (hashicorp#8402) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp#14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (#8402) (#15325) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to #14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (#8402) (#5964) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (#8402) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (#8402) (#1211) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158. Signed-off-by: Modular Magician <[email protected]>
…o identityplatform config (GoogleCloudPlatform#8402) * Add Add BlockingFunctionsConfig, AuthorizedDomains and QuotaConfig fields to Config.yaml * adding new fields to identity_platform_config_basic.tf.erb * Update Config.yaml Temporarily enable VCR to run the tests. Also, provide a more user's friendly desc for the quota field. * Fix the failing test * Update Config.yaml Fix the quota start_time format. * Attempt 2: Fix the failing test * Update Config.yaml Enabling VCR. * Update Config.yaml Re-enable skip_vcr due to hashicorp/terraform-provider-google#14158.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm going to update the issue description with a list of data sources that have been migrated to the plugin framework, and acceptance tests including those data sources are likely to be affected. It is possible for the VCR system to not have recorded interactions for other reasons than issues with the plugin framework migration. Edit: Done, the failing acceptance tests listed on this issue map pretty well to the migrated data sources. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
InvestigationStuff from running TestAccDataSourceDnsManagedZone_basic in VCR_MODE=RECORDING locallyThe test passes, there are files made but they're 'incomplete':
There should be more than 1 interaction listed for the test that provisions and deletes resources. The single interaction recorded there is from the plugin framework provider, because "terraform-plugin-framework" is in the user agent. Where are the other API interactions for the PF provider? Stuff from running the above with a debugger in the VCR-related codeAfter investigating this a bit I've found the problem shows up in the acctest package's That function has a block that's repeated once per SDK/PF provider (SDK provider block is first, PF provider block is second). Those blocks roughly perform these actions:
When you run a test in VCR mode there will be an SDK and PF client present. When the first block (SDK) runs it has access to the vcr source and as a result is able to save VCR stuff to file. That block ends by deleting the vcr source from the global map variable. The PF block runs immediately after and cannot find the vcr source, as it was just deleted, and doesn't write anything to file. Edit: this only impacts saving the seed, not the YAML file.
Thinking forward, this suggests there are problems with tests that will use the 2 separate clients of the SDK and PF provider configs. Especially if you look at the comment above
By having different clients for the SDK and PF code we break the assumption of "a single HTTP transport for a given test, allowing for recording of HTTP interactions" |
More notes:
|
In addition to what I said before, there is another incompatibility between VCR and the PF-implemented data source: When performing Read actions (no C/U/D on data source) a new client is used which is separate to the client within the provider's config. When you enable TF_LOG = DEBUG or higher you don't see the request/response from when the data source is being read into state because this new client is separate to that logging logic somehow. The 'central' client in the PF provider is referenced here via option.WithHTTPClient when setting up the new client though. However when the 'check destroy' function for the acc test does an HTTP request using the plugin-framework provider's client, instead of a new client made in the Read function, that request is reflected in the debug logs and is the single API interaction shown in the VCR recordings from my investigation above. Summary
Solutions?Looks like making the muxed provider use a single central client would be a good idea to ensure VCR compatibility during migrations in future. And to avoid using client libraries within migrated datasources. For now we should avoid any new PF-migrated data sources or resources until these problems are addressed. I'm going to be working on planning proposals for re-starting the muxing/migration project this quarter so I won't be acting on any of the ideas above any time soon. But doing this investigation was very useful for figuring out previously unidentified risks with the migration project. |
I'm currently writing up an RFC that includes discussion about this issue and possible solutions. While I was taking a look in the code I noticed that the SDK provider has some caching, due to how the provider will be re-configured multiple times during a test: terraform-provider-google/google/acctest/vcr_utils.go Lines 452 to 458 in f358149
It doesn't look like there's similar caching for the PF provider. Depending on what solution we go with we may need to look into that. |
Update: I've been working on fixing issues with the muxing in the Google provider(s) and those changes fix the issue with VCR tests. I won't close this issue until those changes are merged, but this issue is 'solved' in that I know why it happens and I have an early version of a fix implemented |
…ovider-google#14158 - Use of older TPG versions through ExternalProviders breaks VCR, so that is also removed from TestAccDataSourceGoogleFirebaseAppleAppConfig
…ovider-google#14158 - Use of older TPG versions through ExternalProviders breaks VCR, so that is also removed from TestAccDataSourceGoogleFirebaseAppleAppConfig
…ovider-google#14158 - Use of older TPG versions through ExternalProviders breaks VCR, so that is also removed from TestAccDataSourceGoogleFirebaseAppleAppConfig
…ovider-google#14158 - Use of older TPG versions through ExternalProviders breaks VCR, so that is also removed from TestAccDataSourceGoogleFirebaseAppleAppConfig
Failure rates
Impacted tests
Affected Resource(s)
List of resources migrated to the plugin framework
List of data sources migrated to the plugin framework
Affected PR(s)
GoogleCloudPlatform/magic-modules#7580
Message(s)
The text was updated successfully, but these errors were encountered: