From 9646064db8e6e84e9727ca5fd9397a55b3cd3281 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 5 Jun 2024 12:01:24 +0200 Subject: [PATCH] Add test for when interactive jobs dies --- tests/web/test_interactive_apps.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/web/test_interactive_apps.py b/tests/web/test_interactive_apps.py index 3a38cf53..d7a6f02a 100644 --- a/tests/web/test_interactive_apps.py +++ b/tests/web/test_interactive_apps.py @@ -8,6 +8,7 @@ from bartender.web.api.job.interactive_apps import ( InteractiveApplicationConfiguration, + InteractiveAppResult, build_command, run, ) @@ -58,6 +59,22 @@ async def test_run_invalid_payload( await run(job_dir, payload, app_config) +@pytest.mark.anyio +async def test_run_exit42( + job_dir: Path, + app_config: InteractiveApplicationConfiguration, +) -> None: + payload = {"input_file": "input.txt", "output_file": "output.txt"} + app_config.command_template = "echo -n hi && exit 42 && echo bye" + result = await run(job_dir, payload, app_config) + expected = InteractiveAppResult( + returncode=42, + stdout="hi", + stderr="", + ) + assert result == expected + + @pytest.mark.parametrize( "payload, expected", [