Skip to content
Snippets Groups Projects
Commit 6f4ebc04 authored by Robert Rosca's avatar Robert Rosca
Browse files

Add test for invalid run dir, test log output

parent d3049246
No related branches found
No related tags found
1 merge request!670Check for transfer conditional on resolved symlink path
This commit is part of merge request !646. Comments created here will be created in the context of that merge request.
import logging
import sys import sys
from pathlib import Path from pathlib import Path
from unittest import mock from unittest import mock
...@@ -88,7 +89,6 @@ def test_parse_config(): ...@@ -88,7 +89,6 @@ def test_parse_config():
for dcache in [None, None, "DESY_DCACHE_RAW_CC"] for dcache in [None, None, "DESY_DCACHE_RAW_CC"]
} }
) )
async def test_wait_on_transfer( async def test_wait_on_transfer(
tmp_path: Path, tmp_path: Path,
run_links_to: str, run_links_to: str,
...@@ -143,6 +143,38 @@ async def test_wait_on_transfer( ...@@ -143,6 +143,38 @@ async def test_wait_on_transfer(
if not expected_error: if not expected_error:
raise e raise e
@pytest.mark.parametrize(
"repositories",
{
(gpfs_online, gpfs_offline, dcache)
for gpfs_online in [None, None, "XFEL_GPFS_ONLINE_RAW_CC"]
for gpfs_offline in [None, None, "XFEL_GPFS_OFFLINE_RAW_CC"]
for dcache in [None, None, "DESY_DCACHE_RAW_CC"]
}
)
@pytest.mark.asyncio
async def test_wait_on_transfer_invalid_run_dir(caplog, repositories):
response = mock.Mock()
response.status_code = 200
response.json = lambda: {"runs": [{"repositories": {r: None for r in repositories}}]}
client = mock.Mock()
client.get_runs_by_proposal_number_api = mock.Mock(return_value=response)
caplog.set_level(logging.WARNING)
res = await wait_on_transfer(
client,
run=0,
proposal=str(10),
run_dir=Path("/invalid/run/dir"),
max_tries=1,
sleep_completion=0,
)
assert res is None
assert "is not relative to" in caplog.text
@pytest.mark.asyncio @pytest.mark.asyncio
@pytest.mark.parametrize( @pytest.mark.parametrize(
"mock_json, status_code, exception_class, exception_match", "mock_json, status_code, exception_class, exception_match",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment