Skip to content

Commit

Permalink
[batch] provide sufficient information to debug transient errors
Browse files Browse the repository at this point in the history
This provides useful feedback we can use to understand why `test_file_in_current_dir` keeps failing.
  • Loading branch information
Dan King committed Jan 12, 2024
1 parent 1a5f485 commit 02c07fb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions hail/python/test/hailtop/hailctl/batch/test_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ def test_file_with_no_dest(runner: CliRunner):
write_hello(f'{dir}/hello.txt')
write_script(dir, f'{dir}/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt', 'test_job.py'])
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_file_in_current_dir(runner: CliRunner):
with tempfile.TemporaryDirectory() as dir:
os.chdir(dir)
write_hello(f'{dir}/hello.txt')
write_script(dir, f'/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/', 'test_job.py'])
assert res.exit_code == 0
res = runner.invoke(cli.app, ['exit', '1'])
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_file_mount_in_child_dir(runner: CliRunner):
Expand All @@ -56,7 +56,7 @@ def test_file_mount_in_child_dir(runner: CliRunner):
write_hello(f'{dir}/hello.txt')
write_script(dir, '/child/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'hello.txt:/child/', 'test_job.py'])
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_file_mount_in_child_dir_to_root_dir(runner: CliRunner):
Expand All @@ -65,7 +65,7 @@ def test_file_mount_in_child_dir_to_root_dir(runner: CliRunner):
write_hello(f'{dir}/child/hello.txt')
write_script(dir, '/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'child/hello.txt:/', 'test_job.py'])
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_mount_multiple_files(runner: CliRunner):
Expand All @@ -77,7 +77,7 @@ def test_mount_multiple_files(runner: CliRunner):
res = runner.invoke(
cli.app, ['submit', '--files', 'child/hello1.txt:/', '--files', 'child/hello2.txt:/', 'test_job.py']
)
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_dir_mount_in_child_dir_to_child_dir(runner: CliRunner):
Expand All @@ -87,7 +87,7 @@ def test_dir_mount_in_child_dir_to_child_dir(runner: CliRunner):
write_hello(f'{dir}/child/hello2.txt')
write_script(dir, '/child/hello1.txt')
res = runner.invoke(cli.app, ['submit', '--files', 'child/:/child/', 'test_job.py'])
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_file_outside_curdir(runner: CliRunner):
Expand All @@ -97,7 +97,7 @@ def test_file_outside_curdir(runner: CliRunner):
write_hello(f'{dir}/hello.txt')
write_script(dir, '/hello.txt')
res = runner.invoke(cli.app, ['submit', '--files', f'{dir}/hello.txt:/', '../test_job.py'])
assert res.exit_code == 0
assert res.exit_code == 0, (res.output, res.stdout, res.stderr, res.exception)


def test_dir_outside_curdir(runner: CliRunner):
Expand All @@ -108,4 +108,4 @@ def test_dir_outside_curdir(runner: CliRunner):
write_hello(f'{dir}/hello2.txt')
write_script(dir, '/hello1.txt')
res = runner.invoke(cli.app, ['submit', '--files', f'{dir}/:/', '../test_job.py'])
assert res.exit_code == 0, (res.exit_code, res.stdout, res.stderr)
assert res.exit_code == 0, (res.exit_code, res.stdout, res.stderr, res.exception)

0 comments on commit 02c07fb

Please sign in to comment.