-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --start-container and --end-container args
These allow the container-level search to be skipped entirely, which enables bisecting at the commit level on containers not from the ghcr.io/nvidia/jax:CONTAINER-YYYY-MM-DD series.
- Loading branch information
Showing
5 changed files
with
143 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import pytest | ||
from jax_toolbox_triage.args import parse_args | ||
|
||
test_command = ["my-test-command"] | ||
valid_start_end_container = [ | ||
"--start-container", | ||
"start-url", | ||
"--end-container", | ||
"end-url", | ||
] | ||
valid_start_end_date_args = [ | ||
["--container", "jax"], | ||
["--container", "jax", "--start-date", "2024-10-02"], | ||
["--container", "jax", "--end-date", "2024-10-02"], | ||
["--container", "jax", "--start-date", "2024-10-01", "--end-date", "2024-10-02"], | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"good_args", [valid_start_end_container] + valid_start_end_date_args | ||
) | ||
def test_good_container_args(good_args): | ||
args = parse_args(good_args + test_command) | ||
assert args.test_command == test_command | ||
|
||
|
||
@pytest.mark.parametrize("date_args", valid_start_end_date_args) | ||
def test_bad_container_arg_combinations_across_groups(date_args): | ||
# Can't combine --{start,end}-container with --container/--{start,end}-date | ||
with pytest.raises(Exception): | ||
parse_args(valid_start_end_container + date_args + test_command) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"container_args", | ||
[ | ||
# Need --container | ||
[], | ||
["--start-date", "2024-10-01"], | ||
["--end-date", "2024-10-02"], | ||
["--start-date", "2024-10-01", "--end-date", "2024-10-02"], | ||
# Need both if either is passed | ||
["--start-container", "start-url"], | ||
["--end-container", "end-url"], | ||
], | ||
) | ||
def test_bad_container_arg_combinations_within_groups(container_args): | ||
with pytest.raises(Exception): | ||
parse_args(container_args + test_command) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"container_args", | ||
[ | ||
# Need valid ISO dates | ||
["--container", "jax", "--start-date", "a-blue-moon-ago"], | ||
["--container", "jax", "--end-date", "a-year-ago-last-thursday"], | ||
], | ||
) | ||
def test_unparsable_container_args(container_args): | ||
with pytest.raises(SystemExit): | ||
parse_args(container_args + test_command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters