From b7f4f94fbd518374b08cbdda6c4f48914882b1ed Mon Sep 17 00:00:00 2001 From: Yuval Yaron Date: Sun, 2 Apr 2023 12:54:25 +0000 Subject: [PATCH] fix root domain for guacamole redirect uri in e2e tests --- e2e_tests/cloud.py | 11 +++++++++++ e2e_tests/test_workspace_services.py | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/e2e_tests/cloud.py b/e2e_tests/cloud.py index a1d065552c..fddf1ab98d 100644 --- a/e2e_tests/cloud.py +++ b/e2e_tests/cloud.py @@ -8,3 +8,14 @@ def get_cloud() -> cloud.Cloud: def get_aad_authority_fqdn() -> str: return urlparse(get_cloud().endpoints.active_directory).netloc + + +def get_azurewebsites_root_domain() -> str: + cloud_name = get_cloud().name + root_domains = {cloud.AZURE_PUBLIC_CLOUD.name: "azurewebsites.net", + cloud.AZURE_US_GOV_CLOUD.name: "azurewebsites.us"} + + if cloud_name not in root_domains: + raise ValueError(f"The root domain of 'azurewebsites' was not configured for '{cloud_name}'") + + return root_domains[cloud_name] diff --git a/e2e_tests/test_workspace_services.py b/e2e_tests/test_workspace_services.py index 56473010d8..3e4fd94d9c 100644 --- a/e2e_tests/test_workspace_services.py +++ b/e2e_tests/test_workspace_services.py @@ -3,6 +3,7 @@ import config from e2e_tests.conftest import get_workspace_owner_token, disable_and_delete_ws_resource from helpers import check_aad_auth_redirect +from cloud import get_azurewebsites_root_domain from resources.resource import post_resource from resources import strings @@ -61,7 +62,7 @@ async def test_create_guacamole_service_into_aad_workspace(setup_test_aad_worksp async def ping_guacamole_workspace_service(workspace_id, workspace_service_id, verify) -> None: short_workspace_id = workspace_id[-4:] short_workspace_service_id = workspace_service_id[-4:] - endpoint = f"https://guacamole-{config.TRE_ID}-ws-{short_workspace_id}-svc-{short_workspace_service_id}.azurewebsites.net/guacamole" + endpoint = f"https://guacamole-{config.TRE_ID}-ws-{short_workspace_id}-svc-{short_workspace_service_id}.{get_azurewebsites_root_domain()}/guacamole" await check_aad_auth_redirect(endpoint, verify)