Skip to content

Commit

Permalink
testsuite: update flux-hostlist tests
Browse files Browse the repository at this point in the history
Problem: The tests for the flux hostlist command are lacking coverage
of some options.

Update t2814-hostlist-cmd.t to cover new functionality.
  • Loading branch information
grondo committed Dec 5, 2024
1 parent fa0e910 commit 211f796
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion t/t2814-hostlist-cmd.t
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,29 @@ test_expect_success 'flux-hostlist -n, --nth works' '
test "$(flux hostlist --nth=1 foo[1-10])" = foo2 &&
test "$(flux hostlist --nth=-1 foo[1-10])" = foo10
'
test_expect_success 'flux-hostlist -n, --nth works with an idset' '
flux hostlist --nth=1,3-4 foo[1-10] &&
test "$(flux hostlist --nth=1,3-4 foo[1-10])" = "foo[2,4-5]" &&
flux hostlist --nth=-1,3-4 foo[1-10] &&
test "$(flux hostlist --nth=-1,3-4 foo[1-10])" = "foo[7-8,10]"
'
test_expect_success 'flux-hostlist -n, --nth works with --expand' '
test "$(flux hostlist -e --nth=1,3-4 foo[1-10])" = "foo2 foo4 foo5"
'
test_expect_success 'flux-hostlist -n errors with invalid index' '
test_must_fail flux hostlist -n 10 foo[1-10]
test_must_fail flux hostlist -n 10 foo[1-10] &&
test_must_fail flux hostlist -n 1,10 foo[1-10]
'
test_expect_success 'flux-hostlist -x, --exclude works' '
test "$(flux hostlist -x foo1 foo[0-10])" = "foo[0,2-10]" &&
test "$(flux hostlist -x foo[0-9] foo[0-10])" = "foo10"
'
test_expect_success 'flux-hostlist -x, --exclude works with indices' '
test "$(flux hostlist -x 1 foo[0-10])" = "foo[0,2-10]" &&
test "$(flux hostlist -x 0-9 foo[0-10])" = "foo10"
'
test_expect_success 'flux-hostlist -n works after -x' '
test "$(flux hostlist -x foo5 -n 5-6 foo[1-10])" = "foo[7-8]"
'
test_expect_success 'flux-hostlist -L, --limit works' '
test "$(flux hostlist -L 2 foo[1-10])" = "foo[1-2]" &&
Expand Down

0 comments on commit 211f796

Please sign in to comment.