Skip to content

Commit

Permalink
testsuite: add ranks constraint tests to t2260-job-list.t
Browse files Browse the repository at this point in the history
Problem: There's no end-to-end job-list 'ranks' constraint tests in
t2260-job-list.t.

Add a few 'ranks' constraint tests to t2260-job-list.t.
  • Loading branch information
grondo committed Jun 19, 2024
1 parent 3995adc commit 342a2a7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions t/t2260-job-list.t
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,33 @@ test_expect_success 'flux job list of all jobs that ran on node[1-2] after certa
test $(cat constraint_hostlist9.out | wc -l) -eq ${numlines}
'

test_expect_success 'flux job list by rank (0-3)' '
constraint="{ and: [ {ranks:[\"0-3\"]} ] }" &&
$jq -j -c -n "{max_entries:1000, attrs:[], constraint:${constraint}}" \
| $RPC job-list.list | $jq .jobs | $jq -c '.[]' | $jq .id > constraint_hostlist1.out &&
numlines=$(cat completed.ids running.ids failed.ids timeout.ids | wc -l) &&
test $(cat constraint_hostlist1.out | wc -l) -eq ${numlines}
'
test_expect_success 'flux job list by rank (3)' '
constraint="{ and: [ {ranks:[\"3\"]} ] }" &&
$jq -j -c -n \
"{max_entries:1000, attrs:[\"ranks\"], constraint:${constraint}}" \
| $RPC job-list.list | $jq -r .jobs[].ranks | uniq > jobs.ranks &&
test $(cat jobs.ranks) -eq 3
'
test_expect_success 'flux job list by rank (does not exist)' '
constraint="{ and: [ {ranks:[\"10\"]} ] }" &&
$jq -j -c -n \
"{max_entries:1000, attrs:[\"ranks\"], constraint:${constraint}}" \
| $RPC job-list.list | $jq -e ".jobs|length == 0"
'
test_expect_success 'flux job list by rank (invalid)' '
constraint="{ and: [ {ranks:[3]} ] }" &&
$jq -j -c -n \
"{max_entries:1000, attrs:[\"ranks\"], constraint:${constraint}}" \
| test_must_fail $RPC job-list.list 2>ranks.err &&
grep "value must be a string" ranks.err
'
#
# legacy RPC tests
#
Expand Down

0 comments on commit 342a2a7

Please sign in to comment.