-
Notifications
You must be signed in to change notification settings - Fork 158
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
E2E: Simplify smoke and extended tests #2871
Changes from all commits
3e5bfbf
ad08fb3
52d99cd
8cfc739
b88d894
92dd814
7f2f6b2
61feaea
45a9ba3
b5a7df4
5afc031
d0ee678
8b0c374
67ff46f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,9 +135,7 @@ jobs: | |
needs: [pr_comment] | ||
if: | | ||
needs.pr_comment.outputs.command == 'run-tests' || | ||
needs.pr_comment.outputs.command == 'run-tests-extended' || | ||
needs.pr_comment.outputs.command == 'run-tests-extended-aad' || | ||
needs.pr_comment.outputs.command == 'run-tests-shared-services' | ||
needs.pr_comment.outputs.command == 'run-tests-extended' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the command be still available for cases where developers know what they want to test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sort of agree - however now that workspaces + services can update those shared services, and do, there's also a case to be made that we should be running all the tests as we need to test the pipeline update from a workspace -> shared service? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think a more future-proof way to do it is would be to run a workflow with a custom selector. This way we can easily extend selectors without having to update PR bot each time.
Well other bundles only really update firewall, and that will be tested by deploying said bundles. I don't think we would need to test shared services each time |
||
name: Deploy PR | ||
uses: ./.github/workflows/deploy_tre_reusable.yml | ||
with: | ||
|
@@ -146,8 +144,6 @@ jobs: | |
ciGitRef: ${{ needs.pr_comment.outputs.ciGitRef }} | ||
e2eTestsCustomSelector: >- | ||
${{ (needs.pr_comment.outputs.command == 'run-tests-extended' && 'extended') || | ||
(needs.pr_comment.outputs.command == 'run-tests-extended-aad' && 'extended_aad') || | ||
(needs.pr_comment.outputs.command == 'run-tests-shared-services' && 'shared_services') || | ||
(needs.pr_comment.outputs.command == 'run-tests' && '') }} | ||
environmentName: CICD | ||
secrets: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import pytest | ||
|
||
from httpx import AsyncClient | ||
from starlette import status | ||
|
||
import config | ||
from helpers import get_auth_header, get_template | ||
from resources import strings | ||
from helpers import get_admin_token | ||
|
||
|
||
pytestmark = pytest.mark.asyncio | ||
|
||
|
||
workspace_templates = [ | ||
(strings.BASE_WORKSPACE) | ||
] | ||
|
||
workspace_service_templates = [ | ||
(strings.AZUREML_SERVICE), | ||
(strings.GUACAMOLE_SERVICE), | ||
(strings.INNEREYE_SERVICE), | ||
(strings.GITEA_SERVICE) | ||
] | ||
|
||
shared_service_templates = [ | ||
(strings.FIREWALL_SHARED_SERVICE), | ||
(strings.GITEA_SHARED_SERVICE), | ||
] | ||
|
||
|
||
@pytest.mark.smoke | ||
@pytest.mark.parametrize("template_name", workspace_templates) | ||
async def test_get_workspace_template(template_name, verify) -> None: | ||
admin_token = await get_admin_token(verify) | ||
# Test that the template is returned in GET request | ||
async with get_template(template_name, strings.API_WORKSPACE_TEMPLATES, admin_token, verify) as response: | ||
assert (response.status_code == status.HTTP_200_OK), f"GET Request for {template_name} creation failed" | ||
|
||
# Test thatt the template is returned in a list GET request | ||
async with AsyncClient(verify=verify) as client: | ||
response = await client.get(f"https://{config.TRE_ID}.{config.RESOURCE_LOCATION}.cloudapp.azure.com{strings.API_WORKSPACE_TEMPLATES}", headers=get_auth_header(admin_token)) | ||
|
||
template_names = [templates["name"] for templates in response.json()["templates"]] | ||
assert (template_name in template_names), f"No {template_name} template found" | ||
|
||
|
||
@pytest.mark.smoke | ||
@pytest.mark.parametrize("template_name", workspace_service_templates) | ||
async def test_get_workspace_service_templates(template_name, verify) -> None: | ||
# Test that the template is returned in GET request | ||
admin_token = await get_admin_token(verify) | ||
async with get_template(template_name, strings.API_WORKSPACE_SERVICE_TEMPLATES, admin_token, verify) as response: | ||
assert (response.status_code == status.HTTP_200_OK), f"GET Request for {template_name} failed" | ||
|
||
# Test that the template is returned in a list GET request | ||
async with AsyncClient(verify=verify) as client: | ||
response = await client.get(f"https://{config.TRE_ID}.{config.RESOURCE_LOCATION}.cloudapp.azure.com{strings.API_WORKSPACE_SERVICE_TEMPLATES}", headers=get_auth_header(admin_token)) | ||
|
||
template_names = [templates["name"] for templates in response.json()["templates"]] | ||
assert (template_name in template_names), f"No {template_name} template found" | ||
|
||
|
||
@pytest.mark.smoke | ||
@pytest.mark.parametrize("template_name", shared_service_templates) | ||
async def test_get_shared_service_templates(template_name, verify) -> None: | ||
# Test that the template is returned in GET request | ||
admin_token = await get_admin_token(verify) | ||
async with get_template(template_name, strings.API_SHARED_SERVICE_TEMPLATES, admin_token, verify) as response: | ||
assert (response.status_code == status.HTTP_200_OK), f"GET Request for {template_name} failed" | ||
|
||
# Test that the template is returned in a list GET request | ||
async with AsyncClient(verify=verify) as client: | ||
admin_token = await get_admin_token(verify) | ||
response = await client.get(f"https://{config.TRE_ID}.{config.RESOURCE_LOCATION}.cloudapp.azure.com{strings.API_SHARED_SERVICE_TEMPLATES}", headers=get_auth_header(admin_token)) | ||
|
||
template_names = [templates["name"] for templates in response.json()["templates"]] | ||
assert (template_name in template_names), f"No {template_name} template found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does one debug a specific test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You couldn't do that before either though? There is still a target for E2E Extended tests, there's just no separate target for AAD.