Skip to content
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

Parallelize WorkSpaces Directory tests #11519

Closed
gdavison opened this issue Jan 8, 2020 · 8 comments · Fixed by #13327
Closed

Parallelize WorkSpaces Directory tests #11519

gdavison opened this issue Jan 8, 2020 · 8 comments · Fixed by #13327
Assignees
Labels
service/workspaces Issues and PRs that pertain to the workspaces service. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Milestone

Comments

@gdavison
Copy link
Contributor

gdavison commented Jan 8, 2020

Description

WorkSpaces Directories require an IAM Role named workspaces_DefaultRole. If the role is created and destroyed as part of each test, they have to be completely serialized, as done in #11505. If the test suite grows, this will slow down execution, so we should try to make the tests parallel. This will require moving the IAM Role to an external dependency which the tests can assume has been defined.

@gdavison gdavison added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 8, 2020
@gdavison gdavison self-assigned this Jan 8, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 8, 2020
@gdavison gdavison added service/workspaces Issues and PRs that pertain to the workspaces service. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Jan 8, 2020
@Tensho
Copy link
Contributor

Tensho commented Jan 15, 2020

Is there any example of the test data with external dependencies? I supposed to think each test case should be self-sufficient and independent.

If I specify Test instead of ParallelTest then it means it will be run serialized out of the box and there is no need for the extra serialization code, isn't it?

@Tensho
Copy link
Contributor

Tensho commented Feb 3, 2020

@gdavison Please could you provide some insight here? 🙏

@gdavison
Copy link
Contributor Author

gdavison commented Mar 3, 2020

It's because the IAM role for the WorkSpaces directories has to be workspaces_DefaultRole. So if we run the tests in parallel, the first test will create the IAM role, but the other tests will fail. Ideally, we could create the IAM role once, run all the tests, then tear down the IAM role, but our framework doesn't currently allow that.

@Tensho
Copy link
Contributor

Tensho commented Mar 6, 2020

@gdavison Yeah, I understand the issue reason and why we need to synchronize tests. What I can't understand, why does tests execution should be synchronized with an imperative code instead of Test declaration? I'd expect simply changing ParallelTest to Test should solve the problem until Terraform test framework provides better solution to handle shared resources.

@bflad
Copy link
Contributor

bflad commented Mar 18, 2020

@Tensho the maintainers use a TeamCity CI environment for running the acceptance testing (both daily and ad-hoc when not running it locally). The TeamCity runner being used splits each test into a separate Go process for parallelization (this was written well before go test -parallel and resource.ParallelTest()) and to capture test panics without affecting other in-progress tests. Using resource.Test() covers the local case, however does not fix our usage of test splitting. Since the imperative code only has one capital-T test, its serialized for both local and our TeamCity environment.

@Tensho
Copy link
Contributor

Tensho commented Mar 18, 2020

@bflad Thank you for the thorough explanation 🙇 Now it's clear for me the code is for CI compatibility reason.

@ghost
Copy link

ghost commented May 29, 2020

This has been released in version 2.64.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Jun 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/workspaces Issues and PRs that pertain to the workspaces service. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants