hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.3k stars 1.73k forks source link

Improve testing related to configuration of the SDK provider #14268

Open SarahFrench opened 1 year ago

SarahFrench commented 1 year ago

Background

The Google provider is currently muxed, i.e. mixes use of the old SDK and the new plugin-framework. In practice, this looks like a muxed server being launched that can route gRPC requests to either plugin-framework or SDK code. This means that both versions of the provider being surfaced by that server need to be configured from the same provider config block and/or ENVs in a users environment.

To ensure that the plugin-framework provider has the same configuration behaviour as the old, SDK provider we need to add tests for the new plugin framework code.

To enable this, we need to improve test coverage in the old SDK provider configuration code to define what behaviour (and edge cases) need to be replicated.

What kind of contribution is this issue about?

Testing

Related PR(s), if any:

Details

Recent issues showing the need for testing improvements

There have been these issues related to provider config:

These areas of provider config in particular need to have new test coverage in both the SDK and the plugin framework code. However it would be best to get to full coverage of all provider config fields (that aren't the custom endpoints).

Relevant files

Here are the relevant files for the SDK provider:

Here are the relevant files for the plugin-framework provider:

SarahFrench commented 1 year ago

Related issue: https://github.com/hashicorp/terraform-provider-google/issues/14255 - edge case of the credentials field that isn't covered by tests

SarahFrench commented 1 year ago

I think given this (https://github.com/hashicorp/terraform-provider-google/issues/13950#issuecomment-1514597357) it would be useful to have tests asserting what token sources are set in the config struct when the provider is configured in different ways.

Different types of token source affect use of the data source google_client_config : https://github.com/hashicorp/terraform-provider-google/blob/e1f8a28d9f7bb8f51783367bdc2d15f837add179/google/data_source_google_client_config.go#L51