Skip to content

test(magician): refactor vcr-merge-test to use testing sandbox#17953

Draft
majedalfaraj wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
majedalfaraj:refactor-vcr-merge
Draft

test(magician): refactor vcr-merge-test to use testing sandbox#17953
majedalfaraj wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
majedalfaraj:refactor-vcr-merge

Conversation

@majedalfaraj

Copy link
Copy Markdown
Contributor

Refactors the test to use the testing sandbox rather than mockRunner. To avoid directly executing gcloud commands, this refactor includes a gcloud bash emulator. This emulator intercepts the CLI commands and translates them to filesys operations, verifying behavioural state without making HTTP requests.


@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jun 12, 2026
@github-actions github-actions Bot requested a review from roaks3 June 12, 2026 07:08
@github-actions

Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@majedalfaraj majedalfaraj marked this pull request as draft June 12, 2026 23:25
The `interceptingRunner` wraps around `exec.Runner` and reroutes commands (such as git, make) to fake scripts inside the sandbox, if they exist. This eliminates the need to modify environment variables and allows for safe parallel testing.
Refactors the test to use the testing sandbox rather than `mockRunner`. To avoid directly executing `gcloud` commands, this refactor includes a `gcloud` bash emulator. This emulator intercepts the CLI commands and translates them to filesys operations, verifying behavioural state without making HTTP requests.
…gRunner

Because the new sandbox framework can intercept and reroute binary calls to temporary directories, manipulating $PATH is no longer necessary. Allows for test to be safely run in parallel.
@majedalfaraj

Copy link
Copy Markdown
Contributor Author

Depends on #17961

@majedalfaraj majedalfaraj marked this pull request as ready for review June 15, 2026 18:15

@roaks3 roaks3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding correctly that this change only impacts these 2 tests? As in, we aren't changing VCR merge behavior or actually adding a sandbox anywhere.

Also, if this is still dependent on the other PR, would would mind converting it into a draft, so it doesn't get merged by accident?

@majedalfaraj majedalfaraj marked this pull request as draft June 17, 2026 20:16
@majedalfaraj

Copy link
Copy Markdown
Contributor Author

Am I understanding correctly that this change only impacts these 2 tests? As in, we aren't changing VCR merge behavior or actually adding a sandbox anywhere.

Also, if this is still dependent on the other PR, would would mind converting it into a draft, so it doesn't get merged by accident?

Yes, this change is intended to simulate the same VCR merge behaviour, but rewrite the implementation-based test to a behaviour-driven one that runs in a sandbox. I converted this PR into a draft until the sandbox PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants