Skip to content

Commit

Permalink
testsuite: test held value for flux-jobs INFO field
Browse files Browse the repository at this point in the history
Problem: No tests in the testsuite ensure that the `contextual_info`
field in flux-jobs output displays the string "held" for jobs with
priority=0.

Add a test that priority=0 shows "held" for the INFO field in
flux-jobs output.
  • Loading branch information
grondo committed Nov 13, 2024
1 parent d847432 commit b2a6cba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion t/t2800-jobs-cmd.t
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test_expect_success 'submit jobs for job list testing' '
#
# Submit a set of jobs with non-default urgencies
#
for u in 31 25 20 15 10 5; do
for u in 31 25 20 15 10 5 0; do
flux job submit --urgency=$u sleeplong.json >> sched.ids
done &&
listjobs > active.ids &&
Expand Down Expand Up @@ -552,6 +552,7 @@ test_expect_success 'flux-jobs --format={urgency},{priority} works' '
echo 15,15 >> urgency_priority.exp &&
echo 10,10 >> urgency_priority.exp &&
echo 5,5 >> urgency_priority.exp &&
echo 0,0 >> urgency_priority.exp &&
for i in `seq 1 $(job_list_state_count run)`; do
echo "16,16" >> urgency_priority.exp
done &&
Expand All @@ -561,6 +562,18 @@ test_expect_success 'flux-jobs --format={urgency},{priority} works' '
test_cmp urgency_priority.out urgency_priority.exp
'

test_expect_success 'flux-jobs --format={contextual_info} shows held job' '
flux jobs -no {urgency}:{contextual_info} | grep 0:held
'

# There is no simple way to create a job with urgency > 0 and priority == 0,
# so test priority-hold using --from-stdin:
test_expect_success 'flux-jobs {contextual_info} shows priority-hold job' '
echo "{\"id\":195823665152,\"state\":8,\"priority\":0,\"urgency\":16}" \
| flux jobs --from-stdin -no {priority}:{contextual_info} \
| grep 0:priority-hold
'

test_expect_success 'flux-jobs --format={state},{state_single} works' '
flux jobs --filter=pending -c1 -no "{state},{state_single}" > stateP.out &&
test "$(cat stateP.out)" = "SCHED,S" &&
Expand Down

0 comments on commit b2a6cba

Please sign in to comment.