Skip to content

Commit

Permalink
t: add 0 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 with a fairshare value of
0, the job will be rejected.
  • Loading branch information
cmoussa1 committed Aug 21, 2021
1 parent 14c44ee commit f8e15a1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions t/t1001-mf-priority-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,28 @@ 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 0 fairshare should result in a job rejection' '
test_must_fail flux mini submit --setattr=system.bank=account4 hostname > zero_fairshare.out 2>&1 &&
test_debug "zero_fairshare.out" &&
grep "user fairshare value is 0" zero_fairshare.out
'

test_done

0 comments on commit f8e15a1

Please sign in to comment.