From a16d2d062d2aa8f558c65cdf5dc658fcc1fb2be7 Mon Sep 17 00:00:00 2001 From: Carlos Marques Date: Tue, 3 Dec 2024 16:30:30 -0300 Subject: [PATCH] Add unit tests for empty job name --- tests/ert/unit_tests/scheduler/test_lsf_driver.py | 7 +++++++ tests/ert/unit_tests/scheduler/test_openpbs_driver.py | 7 +++++++ tests/ert/unit_tests/scheduler/test_slurm_driver.py | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/tests/ert/unit_tests/scheduler/test_lsf_driver.py b/tests/ert/unit_tests/scheduler/test_lsf_driver.py index ff6b9a878a5..fc85b1fa968 100644 --- a/tests/ert/unit_tests/scheduler/test_lsf_driver.py +++ b/tests/ert/unit_tests/scheduler/test_lsf_driver.py @@ -1164,6 +1164,13 @@ async def test_submit_with_resource_requirement_with_bsub_capture(): assert "hname" not in Path("captured_bsub_args").read_text(encoding="utf-8") +@pytest.mark.usefixtures("capturing_bsub") +async def test_empty_job_name(): + driver = LsfDriver() + await driver.submit(0, "/bin/sleep") + assert " -J sleep " in Path("captured_bsub_args").read_text(encoding="utf-8") + + @pytest.mark.integration_test @pytest.mark.usefixtures("use_tmpdir") async def test_submit_with_num_cpu(pytestconfig, job_name): diff --git a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py index 7e72f6e7045..3ab5aa573a7 100644 --- a/tests/ert/unit_tests/scheduler/test_openpbs_driver.py +++ b/tests/ert/unit_tests/scheduler/test_openpbs_driver.py @@ -166,6 +166,13 @@ async def test_job_name(): assert " -Nsleepy " in Path("captured_qsub_args").read_text(encoding="utf-8") +@pytest.mark.usefixtures("capturing_qsub") +async def test_empty_job_name(): + driver = OpenPBSDriver() + await driver.submit(0, "/bin/sleep") + assert " -Nsleep " in Path("captured_qsub_args").read_text(encoding="utf-8") + + @pytest.mark.usefixtures("capturing_qsub") async def test_job_name_with_prefix(): driver = OpenPBSDriver(job_prefix="pre_") diff --git a/tests/ert/unit_tests/scheduler/test_slurm_driver.py b/tests/ert/unit_tests/scheduler/test_slurm_driver.py index e55dd2b056c..1596d2eb17b 100644 --- a/tests/ert/unit_tests/scheduler/test_slurm_driver.py +++ b/tests/ert/unit_tests/scheduler/test_slurm_driver.py @@ -173,6 +173,15 @@ async def test_project_code_is_set(project_code): ) +@pytest.mark.usefixtures("capturing_sbatch") +async def test_empty_job_name(): + driver = SlurmDriver() + await driver.submit(0, "/bin/sleep") + assert "--job-name=sleep" in Path("captured_sbatch_args").read_text( + encoding="utf-8" + ) + + @pytest.mark.usefixtures("capturing_sbatch") @given(max_runtime=st.floats(min_value=1, max_value=999999999)) async def test_max_runtime_is_properly_formatted(max_runtime):