Skip to content

Commit b20c8e5

Browse files
authored
Added information about VCR tests (#11943)
1 parent 991966b commit b20c8e5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/content/contribute/create-pr.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ weight: 10
1717
## Code review
1818

1919
1. A reviewer will automatically be assigned to your PR.
20-
1. Creating a new pull request or pushing a new commit automatically triggers our CI pipelines and workflows. After CI starts, downstream diff generation takes about 10 minutes; VCR tests can take up to 2 hours. If you are a community contributor, some tests will only run after approval from a reviewer.
20+
1. Creating a new pull request or pushing a new commit automatically triggers our CI pipelines and workflows. After CI starts, downstream diff generation takes about 10 minutes; [VCR tests]({{< ref "/develop/test/test.md" >}}) can take up to 2 hours. If you are a community contributor, some tests will only run after approval from a reviewer.
2121
- While convenient, relying on CI to test iterative changes to PRs often adds extreme latency to reviews if there are errors in test configurations or at runtime. We **strongly** recommend you [test your changes locally before pushing]({{< ref "/develop/test/run-tests" >}}) even after the initial change.
22+
- VCR tests will first attempt to play back recorded HTTP requests (REPLAYING mode). If any tests fail, they will run in RECORDING mode to generate a new cassette; then, the same tests will run again in REPLAYING mode to detect any nondeterministic behavior in the test (which can cause flaky tests.)
2223
1. If your assigned reviewer does not respond to changes on a pull request within two US business days, ping them on the pull request.
2324

2425
{{< hint info >}}

docs/content/develop/test/test.md

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ aliases:
1515

1616
This page describes how to add tests to a new resource in the `google` or `google-beta` Terraform provider.
1717

18+
The providers have two basic types of tests:
19+
20+
- Unit tests: test specific functions thoroughly. Unit tests do not interact with GCP APIs.
21+
- Acceptance tests (aka VCR tests, or create and update tests): test that resources interact as expected with the APIs. Acceptance tests interact with GCP APIs, but should only test the provider's behavior in constructing the API requests and parsing the responses.
22+
23+
Acceptance tests are also called "VCR tests" because they use [`go-vcr`](https://github.com/dnaeon/go-vcr) to record and play back HTTP requests. This allows tests to run more quickly on PRs because the resources don't actually need to be created, updated, or destroyed by the live API.
24+
1825
For more information about testing, see the [official Terraform documentation](https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests).
1926

2027
## Before you begin

0 commit comments

Comments
 (0)