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 initial version of a plugin-framework provider config test, move code between packages to allow tests #6180

Conversation

modular-magician
Copy link
Collaborator

This PR begins to add tests that match equivalent tests created for the SDK version of the provider config code. The motivation of adding these tests is to ensure parity between the SDK and plugin framework versions of the provider config code, as muxing the provider resulted in bugs like: hashicorp/terraform-provider-google#14255

Currently there isn't parity in how the two bits of code handle empty strings (see commented out test cases) and I will address that in a separate PR to this one.

To allow the tests to be created I needed to move code between packages to allow reuse of test-related functions and to avoid circular dependencies.


If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)


Derived from GoogleCloudPlatform/magic-modules#8797

…code between packages to allow tests (hashicorp#8797)

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

* Move `ReplaceVarsForFrameworkTest` to `fwresource` package

This mirrors how old, ReplaceVars* functions are in the `tpgresource` package

* Move functions for changing ENVs in tests to `acctest` package, update usage

* Move `GenerateFakeCredentialsJson` function to `acctest` package, update usage

* Refactor provider config tests to use plugin-framework types

* Add all test cases to match equivalent SDK provider config tests

Some test cases currently fail due to different handling of empty values by the SDK and plugin framework

* 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

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician merged commit ac37ec7 into hashicorp:main Aug 30, 2023
@modular-magician modular-magician deleted the downstream-pr-1b2c1a12b1ca61943f699da99510d8e67b07b756 branch November 16, 2024 02:04
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