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

Refactor muxing 1 : Re-use same config to configure the SDK and PF providers, fix VCR testing #11903

Merged

Conversation

SarahFrench
Copy link
Contributor

@SarahFrench SarahFrench commented Oct 3, 2024

Fixes hashicorp/terraform-provider-google#19197
Fixes hashicorp/terraform-provider-google#18774
Fixes hashicorp/terraform-provider-google#20280

Summary

This PR:

  • Changes how the plugin-framework implementation of the provider is configured
    • Before: Parallel implementation of configuration logic that parses user inputs and populates a fwtransport.FrameworkProviderConfig struct
    • After: The configure function obtains an already populated transport_tpg.Config struct from the SDK provider, with no duplication of logic to process user inputs.
  • Changes code defining the VCR system to accommodate the change above
  • Makes necessary changes to the data sources currently implemented with the plugin-framework
    • These now expect to receive a transport_tpg.Config struct
    • Any provider-level values are now in the old type system, and require thought about where we convert between those type systems.

Things to pay attention to during review/testing


provider: refactored how the provider configuration is handled internally

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 15 files changed, 157 insertions(+), 179 deletions(-))
google-beta provider: Diff ( 21 files changed, 201 insertions(+), 222 deletions(-))

@SarahFrench
Copy link
Contributor Author

SarahFrench commented Oct 3, 2024

Initial acc tests for the SDK and PF provider code. These tests aren't final, as we're waiting for some more acc tests to be added to the code base and then pulled into this PR.

GA Provider:

Beta Provider:


Test failures:

  • In the Framework builds lots of tests currently fail with Attribute 'X' found when not expected
    • Explanation: this is because in the new PF type system if a string field's value is null the field isn't present at all, whereas in the SDK system the field would have a value of "".
    • User impact? : Values that were once null will become "" when passed to PF-implemented resources.
    • Code changes : This is an example of where we can just update the test
  • Changes cause "" values of request_reason to no longer be used in the PF code, instead any present ENVs will be used instead
  • Test flakiness is impacting:

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4138
Passed tests: 3716
Skipped tests: 411
Affected tests: 11

Click here to see the affected service packages

All service packages are affected

Action taken

Found 11 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataSourceGoogleFirebaseAndroidAppConfig
  • TestAccDataSourceGoogleFirebaseAppleAppConfig
  • TestAccDataSourceGoogleQuotaInfos_basic
  • TestAccDataformRepositoryReleaseConfig_dataformRepositoryReleaseConfigExample
  • TestAccDataformRepositoryWorkflowConfig_dataformRepositoryWorkflowConfigExample
  • TestAccDataformRepository_dataformRepositoryWithCloudsourceRepoAndSshExample
  • TestAccDataformRepository_updated
  • TestAccDataprocCluster_withAutoscalingPolicy
  • TestAccFirebaseWebApp_firebaseWebAppFull
  • TestAccFrameworkProviderBasePath_setBasePath
  • TestAccFrameworkProviderMeta_setModuleName

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDataSourceGoogleFirebaseAndroidAppConfig[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccFirebaseWebApp_firebaseWebAppFull[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDataSourceGoogleQuotaInfos_basic[Error message] [Debug log]
TestAccDataformRepositoryReleaseConfig_dataformRepositoryReleaseConfigExample[Error message] [Debug log]
TestAccDataformRepositoryWorkflowConfig_dataformRepositoryWorkflowConfigExample[Error message] [Debug log]
TestAccDataformRepository_dataformRepositoryWithCloudsourceRepoAndSshExample[Error message] [Debug log]
TestAccDataformRepository_updated[Error message] [Debug log]
TestAccDataprocCluster_withAutoscalingPolicy[Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@SarahFrench
Copy link
Contributor Author

Latest commits address some of the test failures described in this comment.

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccFrameworkProviderBasePath_setBasePath[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDataSourceGoogleQuotaInfos_basic[Error message] [Debug log]
TestAccDataformRepositoryReleaseConfig_dataformRepositoryReleaseConfigExample[Error message] [Debug log]
TestAccDataformRepositoryWorkflowConfig_dataformRepositoryWorkflowConfigExample[Error message] [Debug log]
TestAccDataformRepository_dataformRepositoryWithCloudsourceRepoAndSshExample[Error message] [Debug log]
TestAccDataformRepository_updated[Error message] [Debug log]
TestAccDataprocCluster_withAutoscalingPolicy[Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccFrameworkProviderBasePath_setBasePath[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDataSourceGoogleQuotaInfos_basic[Error message] [Debug log]
TestAccDataformRepositoryReleaseConfig_dataformRepositoryReleaseConfigExample[Error message] [Debug log]
TestAccDataformRepositoryWorkflowConfig_dataformRepositoryWorkflowConfigExample[Error message] [Debug log]
TestAccDataformRepository_dataformRepositoryWithCloudsourceRepoAndSshExample[Error message] [Debug log]
TestAccDataformRepository_updated[Error message] [Debug log]
TestAccDataprocCluster_withAutoscalingPolicy[Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

Copy link
Contributor

@rainshen49 rainshen49 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval for Firebase since the changes are mechanical in nature and Firebase tests are passing.

…ruct

This allows the PF provider to access any data on the SDK provider, including the meta/Config struct that will be created when the SDK provider is configured.
…struct to all data sources and resources, instead of `FrameworkProviderConfig`
… Config struct to be usable in those places.

- Replace use of FrameworkProviderConfig with Config
- Add Beta-only `NewFirebaseClient` method to Config struct for use with Firebase data sources
- Update LocationDescriber interface
- Misc places where the SDK and PF type systems meet and string needs to be converted to types.StringType
- This carries over the idea of configuring the PF provider using the SDK provider. The changes in the MuxedProviders func mimic changes already made in main.go.
- Remove unnecessary duplication of cached configs per test name; now one used regardless of PF/SDK
- Updates to some DestroyProducer functions so they access the cached SDK Config struct to get a client
- Remove GetFwTestProvider and the file containing it - this isn't needed.
…ovider-google#14158

- Use of older TPG versions through ExternalProviders breaks VCR, so that is also removed from TestAccDataSourceGoogleFirebaseAppleAppConfig
…e now ignored and ENVs can be used instead
…el_addition_strategy` acctest to reflect how the SDK configuration logic now affects the PF provider
…se of ExternalProviders to get other versions of TPG/TPGB
@modular-magician

This comment was marked as duplicate.

@SarahFrench SarahFrench removed the request for review from rainshen49 November 7, 2024 20:01
@modular-magician

This comment was marked as outdated.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 25 files changed, 250 insertions(+), 231 deletions(-))
google-beta provider: Diff ( 31 files changed, 295 insertions(+), 275 deletions(-))

@SarahFrench SarahFrench requested review from c2thorn and NickElliot and removed request for rainshen49 November 11, 2024 13:39
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4285
Passed tests: 3874
Skipped tests: 408
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupPlan_backupDrBackupPlanSimpleExample
  • TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy
  • TestAccContainerCluster_withFleetConfig

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccBackupDRBackupPlan_backupDrBackupPlanSimpleExample [Error message] [Debug log]
TestAccContainerCluster_withFleetConfig [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think the comment updates achieve what I was looking for

Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be good to merge this. LGTM, thanks @SarahFrench

@SarahFrench
Copy link
Contributor Author

/gcbrun

@SarahFrench
Copy link
Contributor Author

Thank you both! I'm just going to do one last test run before merging, partly so that there's an autogen pr branch for this PR for reference in future (the old one was deleted recently).

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 25 files changed, 250 insertions(+), 231 deletions(-))
google-beta provider: Diff ( 31 files changed, 295 insertions(+), 275 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4306
Passed tests: 3899
Skipped tests: 405
Affected tests: 2

Click here to see the affected service packages

All service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApigeeDeveloper_apigeeDeveloperUpdateTest
  • TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccApigeeDeveloper_apigeeDeveloperUpdateTest [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@SarahFrench SarahFrench removed the request for review from rainshen49 November 21, 2024 16:45
@SarahFrench SarahFrench merged commit 4760ae5 into GoogleCloudPlatform:main Nov 21, 2024
12 of 13 checks passed
amanMahendroo pushed a commit to amanMahendroo/magic-modules that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment