|
34 | 34 | import playwright.sync_api as sync_api |
35 | 35 | import rich.logging |
36 | 36 |
|
| 37 | +ATR_BASE_URL: Final[str] = os.environ.get("ATR_BASE_URL", "https://localhost.apache.org:8080") |
37 | 38 | OPENPGP_TEST_UID: Final[str] = "<apache-tooling@example.invalid>" |
38 | 39 | SSH_KEY_COMMENT: Final[str] = "atr-playwright-test@127.0.0.1" |
39 | 40 | SSH_KEY_PATH: Final[str] = "/root/.ssh/id_ed25519" |
@@ -92,7 +93,7 @@ def get_default_gateway_ip() -> str | None: |
92 | 93 |
|
93 | 94 |
|
94 | 95 | def go_to_path(page: sync_api.Page, path: str, wait: bool = True) -> None: |
95 | | - page.goto(f"https://localhost.apache.org:8080{path}") |
| 96 | + page.goto(f"{ATR_BASE_URL}{path}") |
96 | 97 | if wait: |
97 | 98 | wait_for_path(page, path) |
98 | 99 |
|
@@ -313,21 +314,22 @@ def main() -> None: |
313 | 314 | ) |
314 | 315 |
|
315 | 316 | logging.debug(f"Log level set to {args.log.upper()}") |
316 | | - # Add localhost.apache.org to /etc/hosts |
317 | | - default_gateway_ip = get_default_gateway_ip() |
318 | | - if default_gateway_ip is not None: |
319 | | - with open("/etc/hosts", "a") as f: |
320 | | - f.write(f"{default_gateway_ip} localhost.apache.org\n") |
321 | | - logging.info(f"Added localhost.apache.org to /etc/hosts with IP {default_gateway_ip}") |
322 | | - else: |
323 | | - logging.warning("Could not determine default gateway IP, skipping /etc/hosts modification") |
| 317 | + if "ATR_BASE_URL" not in os.environ: |
| 318 | + # Add localhost.apache.org to /etc/hosts |
| 319 | + default_gateway_ip = get_default_gateway_ip() |
| 320 | + if default_gateway_ip is not None: |
| 321 | + with open("/etc/hosts", "a") as f: |
| 322 | + f.write(f"{default_gateway_ip} localhost.apache.org\n") |
| 323 | + logging.info(f"Added localhost.apache.org to /etc/hosts with IP {default_gateway_ip}") |
| 324 | + else: |
| 325 | + logging.warning("Could not determine default gateway IP, skipping /etc/hosts modification") |
324 | 326 |
|
325 | 327 | run_tests(args.skip_slow, args.tidy) |
326 | 328 |
|
327 | 329 |
|
328 | 330 | def poll_for_tasks_completion(page: sync_api.Page, project_name: str, version_name: str, revision: str) -> None: |
329 | 331 | rev_path = f"{project_name}/{version_name}/{revision}" |
330 | | - polling_url = f"https://localhost.apache.org:8080/admin/ongoing-tasks/{rev_path}" |
| 332 | + polling_url = f"{ATR_BASE_URL}/admin/ongoing-tasks/{rev_path}" |
331 | 333 | logging.info(f"Polling URL: {polling_url}") |
332 | 334 |
|
333 | 335 | max_wait_seconds = 18 |
@@ -930,17 +932,17 @@ def test_projects_02_check_directory(page: sync_api.Page, credentials: Credentia |
930 | 932 | go_to_path(page, "/projects") |
931 | 933 | logging.info("Project directory page loaded") |
932 | 934 |
|
933 | | - logging.info("Checking for the Apache Tooling project card") |
934 | | - h3_locator = page.get_by_text("Apache Tooling", exact=True) |
935 | | - tooling_card_locator = h3_locator.locator("xpath=ancestor::div[contains(@class, 'project-card')]") |
936 | | - sync_api.expect(tooling_card_locator).to_be_visible() |
937 | | - logging.info("Apache Tooling project card found successfully") |
| 935 | + logging.info("Checking for the Apache Test project card") |
| 936 | + h3_locator = page.get_by_text("Apache Test", exact=True) |
| 937 | + test_card_locator = h3_locator.locator("xpath=ancestor::div[contains(@class, 'project-card')]") |
| 938 | + sync_api.expect(test_card_locator).to_be_visible() |
| 939 | + logging.info("Apache Test project card found successfully") |
938 | 940 |
|
939 | 941 |
|
940 | 942 | def test_projects_03_add_project(page: sync_api.Page, credentials: Credentials) -> None: |
941 | | - base_project_label = "tooling" |
942 | | - project_name = "Apache Tooling Test Example" |
943 | | - project_label = "tooling-test-example" |
| 943 | + base_project_label = "test" |
| 944 | + project_name = "Apache Test Example" |
| 945 | + project_label = "test-example" |
944 | 946 |
|
945 | 947 | logging.info("Navigating to the add derived project page") |
946 | 948 | go_to_path(page, f"/project/add/{base_project_label}") |
@@ -1040,14 +1042,18 @@ def test_ssh_02_rsync_upload(page: sync_api.Page, credentials: Credentials) -> N |
1040 | 1042 |
|
1041 | 1043 | logging.info(f"Starting rsync upload test for {project_name}-{version_name}") |
1042 | 1044 |
|
1043 | | - gateway_ip = get_default_gateway_ip() |
1044 | | - if not gateway_ip: |
1045 | | - raise RuntimeError("Cannot proceed without gateway IP") |
| 1045 | + if "ATR_BASE_URL" in os.environ: |
| 1046 | + ssh_host = os.environ.get("ATR_BASE_URL", "").replace("https://", "").replace(":8080", "") |
| 1047 | + else: |
| 1048 | + gateway_ip = get_default_gateway_ip() |
| 1049 | + if not gateway_ip: |
| 1050 | + raise RuntimeError("Cannot proceed without gateway IP") |
| 1051 | + ssh_host = gateway_ip |
1046 | 1052 |
|
1047 | 1053 | username = credentials.username |
1048 | 1054 | ssh_command = "ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" |
1049 | 1055 | source_path = f"{source_dir_abs}/" |
1050 | | - destination = f"{username}@{gateway_ip}:/{project_name}/{version_name}/" |
| 1056 | + destination = f"{username}@{ssh_host}:/{project_name}/{version_name}/" |
1051 | 1057 |
|
1052 | 1058 | rsync_cmd = [ |
1053 | 1059 | "rsync", |
|
0 commit comments