feat: Support for dispatching to isolated projects/service accounts #3201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for a new testing mode, in which test setup creates multiple projects and service accounts, and each module's tests run in these projects, isolated from one another. This is to allow the projects to have separate services enabled, and to allow the service accounts to have different permissions enabled.
An example of how this would be used in a specific repo is here: https://github.com/GoogleCloudPlatform/terraform-google-cloud-run/pull/408/files.
Unfortunately, I didn't see a simpler way to acoomplish the task of "searching for all modules currently being tested" than doing a graph search over modules. This diagram illustrates the possibilities of which modules could reference which other modules, and the graph traversal needs to be able to handle all of those cases:
The current implementation relies on module-swapper having been run before tests are run. If not, and the test setup has been migrated over to isolated projects, running tests will fail with a "project_id was not supplied" error.