Skip to content

Commit

Permalink
[WIP] t: add tests for jobs sent back to PRIORITY
Browse files Browse the repository at this point in the history
Problem: There are no tests for pending jobs that are sent back to
PRIORITY after a Flux restart.

Add some tests.
  • Loading branch information
cmoussa1 committed Jan 31, 2025
1 parent c176db3 commit f3bf982
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TESTSCRIPTS = \
t1045-issue478.t \
t1046-issue565.t \
t1047-issue564.t \
t1048-issue575.t \
t5000-valgrind.t \
python/t1000-example.py \
python/t1001_db.py \
Expand Down
63 changes: 63 additions & 0 deletions t/t1048-issue575.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

test_description='test reloading job-manager with pending jobs'

. `dirname $0`/sharness.sh
MULTI_FACTOR_PRIORITY=${FLUX_BUILD_DIR}/src/plugins/.libs/mf_priority.so
SUBMIT_AS=${SHARNESS_TEST_SRCDIR}/scripts/submit_as.py
DB_PATH=$(pwd)/FluxAccountingTest.db

test_under_flux 1 job

flux setattr log-stderr-level 1

test_expect_success 'allow guest access to testexec' '
flux config load <<-EOF
[exec.testexec]
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'

test_expect_success 'start flux-accounting service' '
flux account-service -p ${DB_PATH} -t
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'

test_expect_success 'check that mf_priority plugin is loaded' '
flux jobtap list | grep mf_priority
'

test_expect_success 'add some banks to the DB' '
flux account add-bank root 1 &&
flux account add-bank --parent-bank=root A 1
'

test_expect_success 'add an association to the DB' '
flux account add-user --username=user1 --userid=5001 --bank=A
'

test_expect_success 'send flux-accounting DB information to the plugin' '
flux account-priority-update -p $(pwd)/FluxAccountingTest.db
'

test_expect_success 'stop scheduler from allocating resources to jobs' '
flux queue stop
'

test_expect_success 'submit job and make sure it is pending' '
job=$(flux python ${SUBMIT_AS} 5001 sleep 60) &&
flux job wait-event -vt 5 ${job} priority
'

test_expect_success 'cancel job' '
flux cancel ${job}
'

test_done

0 comments on commit f3bf982

Please sign in to comment.