Skip to content

Commit

Permalink
Merge pull request #454 from cmoussa1/rm.flux-job-cancel
Browse files Browse the repository at this point in the history
testsuite: replace `flux job cancel` --> `flux cancel`
  • Loading branch information
mergify[bot] authored May 29, 2024
2 parents 351ae02 + c3b5500 commit 46020e5
Show file tree
Hide file tree
Showing 18 changed files with 197 additions and 197 deletions.
28 changes: 14 additions & 14 deletions t/t1001-mf-priority-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -98,62 +98,62 @@ test_expect_success 'update plugin with sample test data' '

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 &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job1.test &&
cat <<-EOF >job1.expected &&
45321
EOF
test_cmp job1.expected job1.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job with custom urgency' '
jobid=$(flux submit --setattr=system.bank=account3 --urgency=15 -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job2.test &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job2.test &&
cat <<-EOF >job2.expected &&
45320
EOF
test_cmp job2.expected job2.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job with urgency of 0' '
jobid=$(flux submit --setattr=system.bank=account3 --urgency=0 -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job3.test &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job3.test &&
cat <<-EOF >job3.expected &&
0
EOF
test_cmp job3.expected job3.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job with urgency of 31' '
jobid=$(flux submit --setattr=system.bank=account3 --urgency=31 -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job4.test &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job4.test &&
cat <<-EOF >job4.expected &&
4294967295
EOF
test_cmp job4.expected job4.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job with other bank' '
jobid=$(flux submit --setattr=system.bank=account2 -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job5.test &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job5.test &&
cat <<-EOF >job5.expected &&
11345
EOF
test_cmp job5.expected job5.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job using default bank' '
jobid=$(flux submit -n1 hostname) &&
flux job wait-event -f json $jobid priority | jq '.context.priority' > job6.test &&
flux job wait-event -f json ${jobid} priority | jq '.context.priority' > job6.test &&
cat <<-EOF >job6.expected &&
45321
EOF
test_cmp job6.expected job6.test &&
flux job cancel $jobid
flux cancel ${jobid}
'

test_expect_success 'submit a job using a bank the user does not belong to' '
Expand Down Expand Up @@ -220,12 +220,12 @@ test_expect_success 'resend user/bank information with valid data and successful
EOF
flux python ${SEND_PAYLOAD} valid_info.json &&
jobid2=$(flux python ${SUBMIT_AS} 5011 sleep 10)
flux job wait-event -f json $jobid2 priority | jq '.context.priority' > job2.test &&
flux job wait-event -f json ${jobid2} priority | jq '.context.priority' > job2.test &&
cat <<-EOF >job2.expected &&
45321
EOF
test_cmp job2.expected job2.test &&
flux job cancel $jobid2
flux cancel ${jobid2}
'

test_done
58 changes: 29 additions & 29 deletions t/t1005-max-jobs-limits.t
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ test_expect_success 'a submitted job while at max-running-jobs limit will have a
jobid3=$(flux python ${SUBMIT_AS} 5011 sleep 60) &&
flux job wait-event -vt 60 \
--match-context=description="max-running-jobs-user-limit" \
$jobid3 dependency-add
${jobid3} dependency-add
'

test_expect_success 'a job transitioning to job.state.inactive should release a held job (if any)' '
flux job cancel $jobid1 &&
flux job wait-event -vt 60 $jobid3 alloc &&
flux job cancel $jobid2 &&
flux job cancel $jobid3
flux cancel ${jobid1} &&
flux job wait-event -vt 60 ${jobid3} alloc &&
flux cancel ${jobid2} &&
flux cancel ${jobid3}
'

test_expect_success 'submit max number of jobs with other bank' '
Expand All @@ -112,9 +112,9 @@ test_expect_success 'a submitted job while at max-running-jobs limit will have a
jobid2=$(flux python ${SUBMIT_AS} 5011 --setattr=system.bank=account2 sleep 60) &&
flux job wait-event -vt 60 \
--match-context=description="max-running-jobs-user-limit" \
$jobid2 dependency-add &&
flux job cancel $jobid1 &&
flux job cancel $jobid2
${jobid2} dependency-add &&
flux cancel ${jobid1} &&
flux cancel ${jobid2}
'

test_expect_success 'submit max number of jobs with a mix of default bank and explicity set bank' '
Expand All @@ -126,8 +126,8 @@ test_expect_success 'a submitted job while at max-running-jobs limit will have a
jobid3=$(flux python ${SUBMIT_AS} 5011 sleep 60) &&
flux job wait-event -vt 60 \
--match-context=description="max-running-jobs-user-limit" \
$jobid3 dependency-add &&
flux job cancel $jobid3
${jobid3} dependency-add &&
flux cancel ${jobid3}
'

test_expect_success 'increase the max jobs count of the user' '
Expand Down Expand Up @@ -156,13 +156,13 @@ test_expect_success 'update plugin with same new sample test data' '
'

test_expect_success 'make sure jobs are still running' '
flux job wait-event -vt 10 $jobid1 alloc &&
flux job wait-event -vt 10 $jobid2 alloc
flux job wait-event -vt 10 ${jobid1} alloc &&
flux job wait-event -vt 10 ${jobid2} alloc
'

test_expect_success 'cancel all remaining jobs' '
flux job cancel ${jobid1} &&
flux job cancel ${jobid2}
flux cancel ${jobid1} &&
flux cancel ${jobid2}
'

test_expect_success 'submit max number of jobs' '
Expand All @@ -176,10 +176,10 @@ test_expect_success '5th submitted job should be rejected because user has reach
test_must_fail flux python ${SUBMIT_AS} 5011 sleep 60 > max_active_jobs.out 2>&1 &&
test_debug "cat max_active_jobs.out" &&
grep "user has max active jobs" max_active_jobs.out &&
flux job cancel $jobid1 &&
flux job cancel $jobid2 &&
flux job cancel $jobid3 &&
flux job cancel $jobid4
flux cancel ${jobid1} &&
flux cancel ${jobid2} &&
flux cancel ${jobid3} &&
flux cancel ${jobid4}
'

test_expect_success 'update max_active_jobs limit' '
Expand Down Expand Up @@ -222,24 +222,24 @@ test_expect_success '6th submitted job should be rejected because user has reach
'

test_expect_success 'cancel one of the active jobs' '
flux job cancel $jobid5
flux cancel ${jobid5}
'

test_expect_success 'newly submitted job should now be accepted since user is under their max_active_jobs limit' '
jobid7=$(flux python ${SUBMIT_AS} 5011 sleep 60) &&
flux job wait-event -f json $jobid7 priority | jq '.context.priority' > job7.test &&
flux job wait-event -f json ${jobid7} priority | jq '.context.priority' > job7.test &&
cat <<-EOF >job7.expected &&
45321
EOF
test_cmp job7.expected job7.test
'

test_expect_success 'cancel all remaining active jobs' '
flux job cancel $jobid1 &&
flux job cancel $jobid2 &&
flux job cancel $jobid3 &&
flux job cancel $jobid4 &&
flux job cancel $jobid7
flux cancel ${jobid1} &&
flux cancel ${jobid2} &&
flux cancel ${jobid3} &&
flux cancel ${jobid4} &&
flux cancel ${jobid7}
'

test_expect_success 'create another user with the same limits in multiple banks' '
Expand Down Expand Up @@ -296,10 +296,10 @@ test_expect_success 'submitting a 3rd job under either bank should result in a j
'

test_expect_success 'cancel all remaining jobs' '
flux job cancel $jobid1 &&
flux job cancel $jobid2 &&
flux job cancel $jobid3 &&
flux job cancel $jobid4
flux cancel ${jobid1} &&
flux cancel ${jobid2} &&
flux cancel ${jobid3} &&
flux cancel ${jobid4}
'

test_done
26 changes: 13 additions & 13 deletions t/t1011-job-archive-interface.t
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ test_expect_success 'load job-archive module' '

test_expect_success 'submit a job that does not run' '
job=$(flux submit --urgency=0 sleep 60) &&
flux job wait-event -vt 10 $job priority &&
flux cancel $job &&
wait_db $job ${ARCHIVEDB}
flux job wait-event -vt 10 ${job} priority &&
flux cancel ${job} &&
wait_db ${job} ${ARCHIVEDB}
'

test_expect_success 'run scripts to update job usage and fair-share' '
Expand All @@ -113,10 +113,10 @@ test_expect_success 'submit some jobs so they populate flux-core job-archive' '
jobid2=$(flux submit -N 1 hostname) &&
jobid3=$(flux submit -N 2 hostname) &&
jobid4=$(flux submit -N 1 hostname) &&
wait_db $jobid1 ${ARCHIVEDB} &&
wait_db $jobid2 ${ARCHIVEDB} &&
wait_db $jobid3 ${ARCHIVEDB} &&
wait_db $jobid4 ${ARCHIVEDB}
wait_db ${jobid1} ${ARCHIVEDB} &&
wait_db ${jobid2} ${ARCHIVEDB} &&
wait_db ${jobid3} ${ARCHIVEDB} &&
wait_db ${jobid4} ${ARCHIVEDB}
'

test_expect_success 'call --copy argument to populate jobs table from job-archive DB' '
Expand All @@ -129,9 +129,9 @@ test_expect_success 'submit some sleep 1 jobs under one user' '
jobid1=$(flux submit -N 1 sleep 1) &&
jobid2=$(flux submit -N 1 sleep 1) &&
jobid3=$(flux submit -n 2 -N 2 sleep 1) &&
wait_db $jobid1 ${ARCHIVEDB} &&
wait_db $jobid2 ${ARCHIVEDB} &&
wait_db $jobid3 ${ARCHIVEDB}
wait_db ${jobid1} ${ARCHIVEDB} &&
wait_db ${jobid2} ${ARCHIVEDB} &&
wait_db ${jobid3} ${ARCHIVEDB}
'

test_expect_success 'run fetch-job-records script' '
Expand Down Expand Up @@ -160,9 +160,9 @@ test_expect_success 'submit some sleep 1 jobs under the secondary bank of the sa
jobid1=$(flux submit --setattr=system.bank=account2 -N 1 sleep 1) &&
jobid2=$(flux submit --setattr=system.bank=account2 -N 1 sleep 1) &&
jobid3=$(flux submit --setattr=system.bank=account2 -n 2 -N 2 sleep 1) &&
wait_db $jobid1 ${ARCHIVEDB} &&
wait_db $jobid2 ${ARCHIVEDB} &&
wait_db $jobid3 ${ARCHIVEDB}
wait_db ${jobid1} ${ARCHIVEDB} &&
wait_db ${jobid2} ${ARCHIVEDB} &&
wait_db ${jobid3} ${ARCHIVEDB}
'

test_expect_success 'run custom job-list script' '
Expand Down
28 changes: 14 additions & 14 deletions t/t1012-mf-priority-load.t
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ test_expect_success 'submit sleep 60 jobs with no data update' '
'

test_expect_success 'check that submitted job is in state PRIORITY' '
flux job wait-event -vt 60 $jobid1 depend
flux job wait-event -vt 60 ${jobid1} depend
'

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

test_expect_success 'check that previously held job transitions to RUN' '
flux job wait-event -vt 60 $jobid1 alloc
flux job wait-event -vt 60 ${jobid1} alloc
'

test_expect_success 'submit 2 more sleep jobs' '
Expand All @@ -110,21 +110,21 @@ test_expect_success 'submit 2 more sleep jobs' '
'

test_expect_success 'check flux jobs - should have 1 running job, 2 pending jobs' '
flux job wait-event -vt 60 $jobid1 alloc &&
flux job wait-event -vt 60 ${jobid1} alloc &&
flux job wait-event -vt 60 \
--match-context=description="max-running-jobs-user-limit" \
$jobid2 dependency-add &&
${jobid2} dependency-add &&
flux job wait-event -vt 60 \
--match-context=description="max-running-jobs-user-limit" \
$jobid3 dependency-add
${jobid3} dependency-add
'

test_expect_success 'cancel running jobs one at a time and check that each pending job transitions to RUN' '
flux job cancel $jobid1 &&
flux job wait-event -vt 60 $jobid2 alloc &&
flux job cancel $jobid2 &&
flux job wait-event -vt 60 $jobid3 alloc &&
flux job cancel $jobid3
flux cancel ${jobid1} &&
flux job wait-event -vt 60 ${jobid2} alloc &&
flux cancel ${jobid2} &&
flux job wait-event -vt 60 ${jobid3} alloc &&
flux cancel ${jobid3}
'

test_expect_success 'unload mf_priority.so' '
Expand All @@ -133,21 +133,21 @@ test_expect_success 'unload mf_priority.so' '

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
flux job wait-event -vt 60 ${jobid4} depend
'

test_expect_success 'reload mf_priority.so with a job still in job.state.priority' '
flux jobtap load ${MULTI_FACTOR_PRIORITY} &&
flux job wait-event -vt 60 $jobid4 depend
flux job wait-event -vt 60 ${jobid4} depend
'

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

test_expect_success 'check that originally pending job transitions to RUN' '
flux job wait-event -vt 60 $jobid4 alloc &&
flux job cancel $jobid4
flux job wait-event -vt 60 ${jobid4} alloc &&
flux cancel ${jobid4}
'

test_done
Loading

0 comments on commit 46020e5

Please sign in to comment.