Skip to content

[POC] Go-VCR: Wrap state change data structures #42930

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

Closed
wants to merge 3 commits into from
Closed

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Jun 9, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

A proof-of-concept for wrapping state change data structures from the Terraform Plugin-SDK V2 retry package with logic to enable replayed VCR acceptance tests. Specifically, when VCR is enabled the delay and poll interval between state change checks is reduced to allow replayed interactions to quickly pass through the CRUD handler's waiting logic. This can significantly reduce test execution times for resources which are slow to provision. For example, ElastiCache clusters:

Standard:

--- PASS: TestAccElastiCacheCluster_Engine_redis (681.65s)
--- PASS: TestAccElastiCacheCluster_Engine_redis_v5 (681.67s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        687.358s

Replayed Interaction:

--- PASS: TestAccElastiCacheCluster_Engine_redis_v5 (10.49s)
--- PASS: TestAccElastiCacheCluster_Engine_redis (10.50s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        16.336s

Relations

Relates #25602
Relates #43039 (an alternative implementation)

Output from Acceptance Testing

Prototyping with the elasticache service, test execution times for basic cluster resource configurations were reduced to ~10 seconds.

% VCR_MODE=REPLAY_ONLY VCR_PATH=/Users/jaredbaker/development/_worktrees/f-vcr-status-check/testdata/ make testacc PKG=elasticache TESTS=TestAccElastiCacheCluster_Engine_redis
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.3 test ./internal/service/elasticache/... -v -count 1 -parallel 20 -run='TestAccElastiCacheCluster_Engine_redis'  -timeout 360m -vet=off
2025/06/09 16:14:19 Creating Terraform AWS Provider (SDKv2-style)...
2025/06/09 16:14:19 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccElastiCacheCluster_Engine_redis_v5 (10.49s)
--- PASS: TestAccElastiCacheCluster_Engine_redis (10.50s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        16.336s

Copy link
Contributor

github-actions bot commented Jun 9, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. labels Jun 9, 2025
@jar-b jar-b force-pushed the f-vcr-status-check branch from 993efaf to 5cac1ad Compare June 9, 2025 20:54
@jar-b jar-b force-pushed the f-vcr-status-check branch from 5cac1ad to b21824d Compare June 10, 2025 13:37
@ewbankkit ewbankkit changed the base branch from release/6.0.0-beta to main June 17, 2025 19:24
@jar-b
Copy link
Member Author

jar-b commented Jun 24, 2025

Closing in favor of #43039

@jar-b jar-b closed this Jun 24, 2025
Copy link
Contributor

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link
Contributor

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 issues.
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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant