Skip to content

Commit

Permalink
Merge pull request #548 from cmoussa1/add.test.descriptions
Browse files Browse the repository at this point in the history
testsuite: add longer test descriptions for some of the more complex test scenarios
  • Loading branch information
mergify[bot] authored Dec 30, 2024
2 parents 3dcb381 + 3f6e1ea commit 9dbe7fc
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 2 deletions.
12 changes: 12 additions & 0 deletions t/t1001-mf-priority-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down Expand Up @@ -96,6 +97,10 @@ test_expect_success 'update plugin with sample test data' '
flux python fake_payload.py
'

# The following set of tests will check the integer priority calculated by the
# priority plugin for two associations. The fair-share of the first association
# is 0.45321 and the fair-share of the second is 0.11345. In addition, job
# priorities get affected if the user sets a custom urgency on their job.
test_expect_success 'submit a job with default urgency' '
jobid=$(flux submit --setattr=system.bank=account3 -n1 hostname) &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job1.test &&
Expand Down Expand Up @@ -156,6 +161,9 @@ test_expect_success 'submit a job using default bank' '
flux cancel ${jobid}
'

# The following two tests ensure job submissions are rejected when a user
# tries to submit a job under a bank they do not belong to or when the format
# of the bank is not valid.
test_expect_success 'submit a job using a bank the user does not belong to' '
test_must_fail flux submit --setattr=system.bank=account1 -n1 hostname > bad_bank.out 2>&1 &&
test_debug "cat bad_bank.out" &&
Expand All @@ -168,6 +176,10 @@ test_expect_success 'reject job when invalid bank format is passed in' '
grep "unable to unpack bank arg" invalid_fmt.out
'

# This set of tests simulates a special case where a portion of the Association
# object that is kept with every job is missing, and therefore, an exception on
# the job is raised with a message explaining that it cannot load the
# information for the job.
test_expect_success 'pass special key to user/bank struct to nullify information' '
cat <<-EOF >null_struct.json
{
Expand Down
1 change: 1 addition & 0 deletions t/t1002-mf-priority-small-no-tie.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down
1 change: 1 addition & 0 deletions t/t1003-mf-priority-small-tie.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down
1 change: 1 addition & 0 deletions t/t1004-mf-priority-small-tie-all.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down
10 changes: 9 additions & 1 deletion t/t1005-max-jobs-limits.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down Expand Up @@ -85,6 +86,13 @@ test_expect_success 'add a default queue and send it to the plugin' '
flux python fake_payload.py
'

# The following set of tests will check that the priority plugin enforces
# accounting limits defined per-association in the flux-accounting database,
# specifically an association's max running jobs and max active jobs limit.
# When the association hits their max running jobs limit, subsequently
# submitted jobs will be held by having an accounting-specific dependency added
# to it. Once they hit their max active jobs limit, subsequently submitted jobs
# will be rejected with an accounting-specific rejection message.
test_expect_success 'submit max number of jobs' '
jobid1=$(flux python ${SUBMIT_AS} 5011 sleep 60) &&
jobid2=$(flux python ${SUBMIT_AS} 5011 sleep 60)
Expand Down Expand Up @@ -117,7 +125,7 @@ test_expect_success 'a submitted job while at max-running-jobs limit will have a
flux cancel ${jobid2}
'

test_expect_success 'submit max number of jobs with a mix of default bank and explicitly set bank' '
test_expect_success 'submit max number of jobs to the same bank (explicitly and by default)' '
jobid1=$(flux python ${SUBMIT_AS} 5011 sleep 60) &&
jobid2=$(flux python ${SUBMIT_AS} 5011 --setattr=system.bank=account3 -n 1 sleep 60)
'
Expand Down
1 change: 1 addition & 0 deletions t/t1008-mf-priority-update.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
2 changes: 1 addition & 1 deletion t/t1011-job-archive-interface.t
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ test_expect_success 'check that job usage and fairshare values get updated' '
'

# if update-usage is called in the same half-life period when no jobs are found
# for a user, their job usage factor should be affected; this test is taken
# for a user, their job usage factor should not be affected; this test is taken
# from the set of job-archive interface Python unit tests
test_expect_success 'call update-usage in the same half-life period where no jobs are run' '
flux account -p ${DB_PATH} update-usage &&
Expand Down
16 changes: 16 additions & 0 deletions t/t1012-mf-priority-load.t
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ test_expect_success 'create fake_payload.py' '
EOF
'

# The following test simulates the following scenario: a user submits a job to
# a bank they do not have access to with the priority plugin loaded BEFORE it
# is updated with flux-accounting information (i.e the plugin knows nothing
# about which users belong to which bank). The plugin is then updated with the
# flux-accounting information, and while looping through the job.state.priority
# callback for each job, discovers that this submitted job comes from a user
# who does not have access to the bank they submitted this job under.
# Therefore, an exception is raised on the job.
test_expect_success 'submitting a job specifying an incorrect bank with no user data results in a job exception' '
jobid0=$(flux submit --setattr=system.bank=account4 -n1 sleep 60) &&
flux python fake_payload.py &&
Expand All @@ -88,6 +96,11 @@ test_expect_success 'unload and reload mf_priority.so' '
flux jobtap list | grep mf_priority
'

# The following set of tests simulates an association submitting a job while
# the priority plugin is loaded BEFORE it is updated with flux-accounting
# information. The plugin holds the job while it waits to receive accounting
# information, and once it is updated, will annotate the job with the bank name
# and allow it to proceed to run.
test_expect_success 'submit sleep 60 jobs with no data update' '
jobid1=$(flux submit -n1 sleep 60)
'
Expand Down Expand Up @@ -131,6 +144,9 @@ test_expect_success 'unload mf_priority.so' '
flux jobtap remove mf_priority.so
'

# The following set of tests makes sure that if a job is held before the plugin
# is successfully loaded and is updated with flux-accounting information, the
# job can still successfully transition to RUN state.
test_expect_success 'submit a job with no plugin loaded' '
jobid4=$(flux submit -n 1 sleep 60) &&
flux job wait-event -vt 60 ${jobid4} depend
Expand Down
1 change: 1 addition & 0 deletions t/t1013-mf-priority-queues.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1015-mf-priority-urgency.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down
1 change: 1 addition & 0 deletions t/t1019-mf-priority-info-fetch.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1020-mf-priority-issue262.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1021-mf-priority-issue332.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1022-mf-priority-issue346.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1027-mf-priority-issue376.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1028-mf-priority-issue385.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB, start flux-accounting service' '
flux account -p $(pwd)/FluxAccountingTest.db create-db &&
flux account-service -p ${DB_PATH} -t
Expand Down
1 change: 1 addition & 0 deletions t/t1029-mf-priority-default-bank.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'load multi-factor priority plugin' '
flux jobtap load -r .priority-default ${MULTI_FACTOR_PRIORITY}
'
Expand Down
1 change: 1 addition & 0 deletions t/t1030-mf-priority-update-queue.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1031-mf-priority-issue406.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1032-mf-priority-update-bank.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

test_expect_success 'create flux-accounting DB' '
flux account -p $(pwd)/FluxAccountingTest.db create-db
'
Expand Down
1 change: 1 addition & 0 deletions t/t1033-mf-priority-update-job.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_expect_success 'allow guest access to testexec' '
allow-guests = true
EOF
'

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

0 comments on commit 9dbe7fc

Please sign in to comment.