Skip to content

Commit

Permalink
t: add null fairshare test
Browse files Browse the repository at this point in the history
Add a new test to t1001-mf-priority-basic.t that sends a
fake payload with an empty fairshare key-value pair to
ensure that if a job is submitted that relies on that fairshare
value, an exception will be raised on that job and a priority
of 0 will be set.
  • Loading branch information
cmoussa1 committed Aug 10, 2021
1 parent bc9dc85 commit f6396e9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions t/t1001-mf-priority-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,31 @@ test_expect_success 'reject job when invalid bank format is passed in' '
grep "unable to unpack bank arg" invalid_fmt.out
'

test_expect_success 'create a fake payload with an empty fairshare key-value pair' '
cat <<-EOF >empty_fairshare.py
import flux
import pwd
import getpass
username = getpass.getuser()
userid = pwd.getpwnam(username).pw_uid
# create a JSON payload
data = {"userid": str(userid), "bank": "account4", "default_bank": "account3", "fairshare": "", "max_jobs": "10"}
flux.Flux().rpc("job-manager.mf_priority.rec_update", data).get()
EOF
'

test_expect_success 'update plugin with sample test data' '
flux python empty_fairshare.py
'

test_expect_success 'submit a job with new bank and empty fairshare results in a held job' '
jobid=$(flux mini submit --setattr=system.bank=account4 -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job7.test &&
cat <<-EOF >job7.expected &&
0
EOF
test_cmp job7.expected job7.test
'

test_done

0 comments on commit f6396e9

Please sign in to comment.