Skip to content

Commit

Permalink
Merge a LSF test into an exisiting
Browse files Browse the repository at this point in the history
  • Loading branch information
berland committed Nov 29, 2023
1 parent 4f739bf commit 6629ec6
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions tests/unit_tests/job_queue/test_lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def mock_bjobs(tmp_path):
# Just to have a log for test purposes what is actually thrown
# towards the bjobs command
with open("bjobs_log", "a+", encoding="utf-8") as f:
f.write(f"{str(sys.argv)}\\n")
f.write(f"{' '.join(sys.argv)}\\n")
"""
)
script_path = tmp_path / "mock_bjobs"
Expand Down Expand Up @@ -118,7 +118,7 @@ def make_mock_bsub(script_path):
# Just a log for testpurposes showing what is thrown against the
# bsub command
with open("bsub_log", "a+", encoding="utf-8") as f:
f.write(f"{str(sys.argv)}\\n")
f.write(f"{' '.join(sys.argv)}\\n")
# Assigning a "unique" job id for each submitted job and print. This
# is how LSF provide response to ERT with the ID of the job.
Expand Down Expand Up @@ -193,29 +193,6 @@ def copy_lsf_poly_case(copy_poly_case, tmp_path):
fh.writelines(config)


@pytest.mark.skip(reason="Needs reimplementation")
@pytest.mark.usefixtures(
"copy_lsf_poly_case",
"mock_bsub",
"mock_bjobs",
"mock_start_server",
)
@pytest.mark.integration_test
def test_run_mocked_lsf_queue():
run_cli(
ert_parser(
ArgumentParser(prog="test_main"),
[
ENSEMBLE_EXPERIMENT_MODE,
"poly.ert",
],
)
)
log = Path("bsub_log").read_text(encoding="utf-8")
for i in range(10):
assert f"'-J', 'poly_{i}'" in log


@pytest.mark.skip(reason="Needs reimplementation")
@pytest.mark.usefixtures("use_tmpdir", "mock_fm_ok")
def test_num_cpu_submitted_correctly_lsf(tmpdir, simple_script):
Expand Down Expand Up @@ -280,3 +257,6 @@ class MockedQueue:
realization.current_state = RealizationState.SUBMITTED
await lsfdriver.submit(realization)
assert str(realization.current_state.id) == "PENDING"

# Assert that the mocked script actually ran:
assert "bsub -J poly_1" in Path("bsub_log").read_text(encoding="utf-8")

0 comments on commit 6629ec6

Please sign in to comment.