Skip to content

Commit

Permalink
Fix num_cpu LSF integration test
Browse files Browse the repository at this point in the history
Contained three bugs:
* Missing -l
* int vs string comparison for num_cpu
* stdout from bhist has line breaks and whitespace indentation at random places
  • Loading branch information
berland committed Jun 7, 2024
1 parent 3aa9c85 commit 97f6b40
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/integration_tests/scheduler/test_lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,17 @@ async def test_submit_with_num_cpu(pytestconfig, job_name):

process = await asyncio.create_subprocess_exec(
"bhist",
"-l",
job_id,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, _ = await process.communicate()
matches = re.search(".*([0-9]+) Processors Requested", stdout.decode())
assert matches and matches[1] == num_cpu
stdout, stderr = await process.communicate()
stdout_no_whitespaces = re.sub(r"\s+", "", stdout.decode())
matches = re.search(r".*([0-9]+)ProcessorsRequested.*", stdout_no_whitespaces)
assert matches and matches[1] == str(
num_cpu
), f"Could not verify processor allocation from stdout: {stdout}, stderr: {stderr}"

assert Path("test").read_text(encoding="utf-8") == "test\n"

Expand Down

0 comments on commit 97f6b40

Please sign in to comment.