Skip to content

Commit

Permalink
t: add tests for holding/releasing jobs
Browse files Browse the repository at this point in the history
Problem: t1034-mf-priority-max-nodes.t does not have any tests
simulating holding and releasing an association's set of jobs due to a
max nodes limit.

Add some tests.
  • Loading branch information
cmoussa1 committed Apr 18, 2024
1 parent aebcb70 commit 68749c1
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion t/t1034-mf-priority-max-nodes.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ test_expect_success 'add a user to the DB' '
--username=user1 \
--userid=5001 \
--bank=A \
--max-nodes=5
--max-nodes=5 \
--max-active-jobs=100 \
--max-running-jobs=99
'

test_expect_success 'send flux-accounting DB information to the plugin' '
Expand Down Expand Up @@ -96,6 +98,29 @@ test_expect_success 'cancel the other job and check that cur_nodes == 0' '
jq -e ".mf_priority_map[0].banks[0].cur_nodes == 0" <query.json
'

test_expect_success 'submit a 5-node job' '
job1=$(flux python ${SUBMIT_AS} 5001 -N5 sleep 60) &&
flux job wait-event -f json $job1 priority
'

test_expect_success 'submit a job that would put user over max-nodes limit' '
held_job=$(flux python ${SUBMIT_AS} 5001 -N1 sleep 60) &&
flux job wait-event -vt 60 $held_job dependency-add &&
flux job info $held_job eventlog > eventlog.out &&
grep "dependency-add" eventlog.out
'

test_expect_success 'cancel running job' '
flux cancel $job1
'

test_expect_success 'check state of held job' '
flux job wait-event -vt 5 $held_job alloc &&
flux job info $held_job eventlog > eventlog.out &&
grep "alloc" eventlog.out &&
flux cancel $held_job
'

test_expect_success 'shut down flux-accounting service' '
flux python -c "import flux; flux.Flux().rpc(\"accounting.shutdown_service\").get()"
'
Expand Down

0 comments on commit 68749c1

Please sign in to comment.