From 708cf2ba725a2a00c2400a83bf97b663da5d728c Mon Sep 17 00:00:00 2001 From: Jonathan Karlsen Date: Tue, 3 Sep 2024 14:40:38 +0200 Subject: [PATCH] Fix general queue options not being added bug --- tests/unit_tests/config/test_ert_config.py | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/unit_tests/config/test_ert_config.py b/tests/unit_tests/config/test_ert_config.py index a2215f45f38..52850f5d607 100644 --- a/tests/unit_tests/config/test_ert_config.py +++ b/tests/unit_tests/config/test_ert_config.py @@ -1644,3 +1644,45 @@ def test_that_empty_params_file_gives_reasonable_error(tmpdir, param_config): with pytest.raises(ConfigValidationError, match="No parameters specified in"): ErtConfig.from_file("config.ert") + + +@pytest.mark.usefixtures("use_tmpdir") +@pytest.mark.parametrize( + "max_running_queue_config_entry", + [ + pytest.param( + """ + MAX_RUNNING 6 + QUEUE_OPTION LSF MAX_RUNNING 2 + QUEUE_OPTION SLURM MAX_RUNNING 2 + """, + id="general_keyword_max_running", + ), + pytest.param( + """ + QUEUE_OPTION TORQUE MAX_RUNNING 6 + MAX_RUNNING 2 + """, + id="queue_option_max_running", + ), + ], +) +def test_queue_config_general_max_running_takes_precedence_over_queue_option( + max_running_queue_config_entry, +): + test_config_file_base = "test" + test_config_file_name = f"{test_config_file_base}.ert" + test_config_contents = dedent( + f""" + NUM_REALIZATIONS 100 + DEFINE storage/- + RUNPATH /runpath/realization-/iter- + ENSPATH /ensemble + QUEUE_SYSTEM TORQUE + {max_running_queue_config_entry} + """ + ) + with open(test_config_file_name, "w", encoding="utf-8") as fh: + fh.write(test_config_contents) + config = ErtConfig.from_file(test_config_file_name) + assert config.queue_config.max_running == 6