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

Add tests around how plugin framework provider configuration code handles billing_project values #6218

Conversation

modular-magician
Copy link
Collaborator

This PR adds plugin framework versions of these SDK provider unit tests
.

During this PR I found that the FrameworkProviderConfig struct used when configuring the plugin framework version of the provider has a BillingProject field but the value is never set. The billing project value is used to configure the provider, but the value isn't accessible after the provider is configured.

In the SDK code, that the plugin framework code mimics, the billing project value is stored in the equivalent struct and is accessed in resource code (example here) to define functions for destroying resources after acceptance test complete.

Because of this I updated the provider config code in GoogleCloudPlatform/magic-modules@4c402e2 so that the billing project value is stored in the final config struct. This has no impact on provider function but does A) align the PF provider to the SDK version and B) enable future work where the billing project value is accessed by resources/data sources


Release Note Template for Downstream PRs (will be copied)


Derived from GoogleCloudPlatform/magic-modules#8861

…dles `billing_project` values (hashicorp#8861)

* Add initial version of plugin framework provider config test affected by inaccessible functions

* Refactor provider config tests to use plugin-framework types

* Add test case about handling of Unknown values for `project`

* Update tests to check values in BOTH the data model and provider config struct after `LoadAndValidateFramework` runs

* Add some tests for `credentials` in plugin framework provider, including test case that fails

* Update `LoadAndValidateFramework` to take a pointer to the provider data model, so mutations to the data within the function change the original struct

This enables tests to track how the data is mutated

* Add remaining `credentials` test cases to check PF/SDK config parity

* Make tests unset ADC ENV automatically, update comments to tests setting ADC ENV

* Add test for behaviour when credentials value is unknown

* Add comment referring devs to where unknown value test is implemented

* Remove duplicated test case

* Fix filename so it's generated correctly

* Remove fmt line

* Update `project` tests that are affected by `LoadAndValidateFramework` now taking a pointer as an argument

* Change strings in SDK version of billing_project tests

* Add plugin framework version of tests for billing_project

* Fix defect in PF code where (FrameworkProviderConfig).BillingProject value never set

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician merged commit 2a166b1 into hashicorp:main Sep 7, 2023
3 of 4 checks passed
@modular-magician modular-magician deleted the downstream-pr-74057ada932a1ba115504b4c1301812b8ecf5dfa branch November 16, 2024 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant