Skip to content

Conversation

@marrobi
Copy link
Member

@marrobi marrobi commented Apr 3, 2025

Fixes #2868

Add ability to reuse workspace across parallel test processes to speed up e2e

Overview

This PR introduces the ability to reuse workspaces across parallel end-to-end (E2E) test processes, significantly improving the speed and efficiency of E2E test execution. The changes include updates to configuration, scripts, Makefile targets, and documentation to support parallelization and workspace reuse.

Key Changes

  • Parallel E2E Test Support:

    • Added support for running E2E tests in parallel by reusing existing workspaces.
    • Introduced the E2E_TESTS_NUMBER_PROCESSES variable to control the number of parallel pytest processes.
    • Updated workflows and scripts to use this variable and enable parallel execution.
  • Configuration and Environment Updates:

    • Added new configuration options in config.sample.yaml for E2E test parallelization and workspace reuse.
    • Updated environment variable handling and consolidated environment scripts.
  • Makefile and Script Enhancements:

    • Added new Makefile targets for preparing and running E2E tests with parallelization.
    • Updated and refactored scripts to support the new parallel test execution model.
  • CI/CD Workflow Adjustments:

    • Modified GitHub Actions workflows to use the new parallelization variables and logic.
    • Improved job selectors and environment setup for E2E test jobs.
  • Documentation:

    • Updated developer and admin documentation to reflect the new E2E test process and configuration options.
    • Removed outdated references to the old E2E test user/app registration flow.
  • Cleanup and Refactoring:

    • Removed deprecated E2E test user/app registration logic and related environment variables.
    • Cleaned up and renamed scripts for clarity and maintainability.

@marrobi marrobi requested review from Copilot and tamirkamara April 3, 2025 14:28
@github-actions
Copy link

github-actions bot commented Apr 3, 2025

Unit Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 836071e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the ability to reuse a workspace across parallel test processes to speed up end-to-end tests by implementing a file locking mechanism and additional logic in the test setup/teardown routines. Key changes include:

  • Enhancements to e2e_tests/conftest.py to support parallel workspace setup and teardown with locking.
  • Documentation updates and GitHub workflow modifications to expose and use the configurable E2E_TESTS_NUMBER_PROCESSES variable.
  • Adjustments in the devcontainer action to include a fallback default for the case where the E2E test process count is not supplied.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
e2e_tests/conftest.py Added functions for JSON file handling, workspace locking logic, and modifications to support parallel execution.
docs/tre-admins/setup-instructions/workflows.md Documentation updated to include the new E2E_TESTS_NUMBER_PROCESSES environment variable.
.github/workflows/pr_comment_bot.yml Workflow updated to parameterize the number of E2E test processes.
.github/workflows/deploy_tre.yml Workflow updated to use the variable for E2E test processes.
.github/actions/devcontainer_run_command/action.yml Action updated to provide a default value for E2E_TESTS_NUMBER_PROCESSES.

@marrobi marrobi requested a review from Copilot May 19, 2025 15:16
@marrobi marrobi marked this pull request as ready for review May 19, 2025 15:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables parallel E2E test execution by reusing a single workspace across pytest worker processes, reducing setup time and improving test throughput.

  • Introduces a file‐lock based fixture to share and reuse the base workspace among workers
  • Adds E2E_TESTS_NUMBER_PROCESSES support, updates CI/workflows, Makefile, and docs for parallel runs
  • Adds assign_airlock_manager_role helper and refactors Airlock tests to use a shared base workspace

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
e2e_tests/test_performance.py Switched workspace auth to Automatic and updated service ID var
e2e_tests/test_airlock.py Refactored Airlock tests to use new shared base workspace fixture
e2e_tests/resources/workspace.py Added assign_airlock_manager_role for MS Graph role assignments
e2e_tests/resources/resource.py Annotated post_resource return type
e2e_tests/pytest.ini Updated pytest markers (removed extended_aad, added manual)
e2e_tests/helpers.py Simplified token helpers and added get_msgraph_token
e2e_tests/conftest.py New parallel‐workspace fixture with file locking logic
e2e_tests/config.py Introduced MS Graph and Guacamole service config variables
e2e_tests/.env.sample Sample env file cleared; needs restoration
docs/tre-developers/end-to-end-tests.md Updated VS Code debug instructions for new .env and config paths
docs/tre-admins/setup-instructions/workflows.md Documented E2E_TESTS_NUMBER_PROCESSES variable
devops/scripts/setup_local_debugging.sh Conditional env cleanup for new variables
devops/scripts/get_access_token.sh Removed password‐flow branch
config.sample.yaml Added commented e2e_tests section
Makefile Added airlock and workspace-services targets; load parallel .env
.github/workflows/pr_comment_bot.yml Inject parallel process var from repository vars
.github/workflows/deploy_tre.yml Updated e2e test selectors and parallel var usage
.github/actions/devcontainer_run_command/action.yml Exposed E2E_TESTS_NUMBER_PROCESSES to devcontainer runs
.devcontainer/devcontainer.json Cleaned up outdated E2E AAD debug configuration
Comments suppressed due to low confidence (2)

e2e_tests/pytest.ini:5

  • The 'airlock' pytest marker is missing in pytest.ini, so tests decorated with @pytest.mark.airlock will trigger unknown‐mark warnings. Please add 'airlock' to the markers list.
manual

@marrobi marrobi requested a review from Copilot May 19, 2025 15:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the E2E testing framework by enabling workspace reuse across parallel test processes, thereby accelerating end-to-end test execution. Key changes include updating authentication types in test resources, refactoring test workflows and fixtures (including file locking for shared workspaces), and adjusting related configuration, CI/CD, and documentation updates.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
e2e_tests/test_performance.py Switches workspace auth type from "Manual" to "Automatic"
e2e_tests/test_airlock.py Updates workspace path references and variable names for clarity
e2e_tests/resources/workspace.py Introduces get_msgraph_token and role assignment via MS Graph API
e2e_tests/resources/resource.py Adds return type annotations to post_resource for improved clarity
e2e_tests/pytest.ini & config files Updates environment variable names to support parallel test execution
conftest.py Refactors workspace setup with file locking and asynchronous cleanup
CI/CD & Makefile files Adapts workflows and build targets to integrate parallel test parameters
Documentation files Updates instructions and references for new E2E parallelization options

@marrobi
Copy link
Member Author

marrobi commented May 20, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15130362385 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi
Copy link
Member Author

marrobi commented May 20, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15132819569 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi
Copy link
Member Author

marrobi commented May 20, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15136238334 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi
Copy link
Member Author

marrobi commented May 20, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15139994904 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi
Copy link
Member Author

marrobi commented May 20, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15145080127 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi
Copy link
Member Author

marrobi commented May 21, 2025

/test-extended

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/15156157858 (with refid 0704a77e)

(in response to this comment from @marrobi)

@marrobi marrobi requested a review from jonnyry June 26, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session fixtures don't have effect with pytest-xdist

1 participant