Add acceptance and internal tests for `gcs` backend, add some test helper functions
Historically the gcs backend hasn't been touched much. In the past I've added a few features but largely left the existing codebase as it was previously. Recently the gcs backend was refactored in https://github.com/hashicorp/terraform/pull/34989 to avoid using the old SDK.
As part of reviewing that PR I started adding a few acceptance tests in this PR. There's a lot more work to be done but I want to avoid this PR getting too big.
This PR:
- Separates acceptance tests and 'internal' tests into separate _test.go files
- Implements some pre-check functions to test for TF_ACC being set and credentials being supplied by the test environment
- When this info is missing the tests are skipped, to enable checks passing in this repo. This repo has no automated testing of the
gcsbackend set up (//TODO!)
- When this info is missing the tests are skipped, to enable checks passing in this repo. This repo has no automated testing of the
- Adds internal tests that assert:
TestBackendConfig_encryptionKey- how the config and ENVs for customer-supplied encryption keys are usedTestBackendConfig_kmsKey- how the config and ENVs for customer-managed (KMS) encryption keys are used
- Adds acc tests the assert:
TestAccBackendConfig_credentials- empty strings in the backend config don't interrupt use of ENVs for creds.- Note: we cannot have tests where we assert a failure, due to legacy reasons.
Target Release
1.8.x
Draft CHANGELOG entry
NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS
Just rebased to include the latest gcs PR
Tests pass when I run them with TF_ACC=1 locally, merging. Thanks for the review John!
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.