|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +test_description='check that sched-simple never double books resources' |
| 4 | + |
| 5 | +# Append --logfile option if FLUX_TESTS_LOGFILE is set in environment: |
| 6 | +test -n "$FLUX_TESTS_LOGFILE" && set -- "$@" --logfile |
| 7 | +. $(dirname $0)/sharness.sh |
| 8 | + |
| 9 | +test_under_flux 1 |
| 10 | + |
| 11 | +# Verify that alloc-check plugin works using alloc-bypass |
| 12 | +test_expect_success 'load alloc-bypass and alloc-check plugins' ' |
| 13 | + flux jobtap load alloc-bypass.so && |
| 14 | + flux jobtap load alloc-check.so |
| 15 | +' |
| 16 | +test_expect_success 'run an alloc-bypass sleep job' ' |
| 17 | + flux submit \ |
| 18 | + -vvv \ |
| 19 | + --wait-event=start \ |
| 20 | + --setattr=alloc-bypass.R="$(flux R encode -r 0)" \ |
| 21 | + -n 1 \ |
| 22 | + sleep inf |
| 23 | +' |
| 24 | +test_expect_success 'a regular job fails with an alloc-check exception' ' |
| 25 | + run_timeout 30 flux submit --flags=waitable -vvv \ |
| 26 | + --wait-event=exception \ |
| 27 | + -N1 /bin/true >bypass.jobid |
| 28 | +' |
| 29 | +test_expect_success 'flux job wait says the job failed' ' |
| 30 | + test_must_fail flux job wait -v $(cat bypass.jobid) |
| 31 | +' |
| 32 | +test_expect_success 'clean up jobs' ' |
| 33 | + flux cancel --all && |
| 34 | + flux queue drain |
| 35 | +' |
| 36 | +test_expect_success 'unload plugins' ' |
| 37 | + flux jobtap remove alloc-check.so && |
| 38 | + flux jobtap remove alloc-bypass.so |
| 39 | +' |
| 40 | + |
| 41 | +# Check that sched-simple doesn't suffer from time limit issue like |
| 42 | +# flux-framework/flux-sched#1043 |
| 43 | +# |
| 44 | +test_expect_success 'configure epilog with 2s delay' ' |
| 45 | + flux config load <<-EOT |
| 46 | + [job-manager] |
| 47 | + plugins = [ |
| 48 | + { load = "perilog.so" }, |
| 49 | + ] |
| 50 | + epilog.command = [ "flux", "perilog-run", "epilog", "-e", "sleep,2" ] |
| 51 | + EOT |
| 52 | +' |
| 53 | +test_expect_success 'load alloc-check plugin' ' |
| 54 | + flux jobtap load alloc-check.so |
| 55 | +' |
| 56 | +test_expect_success 'submit consecutive jobs that exceed their time limit' ' |
| 57 | + (for i in $(seq 5); \ |
| 58 | + do flux submit -N1 -x -t1s sleep inf; \ |
| 59 | + done) >jobids |
| 60 | +' |
| 61 | +test_expect_success 'wait for jobs to complete and capture their stderr' ' |
| 62 | + (for id in $(cat jobids); do \ |
| 63 | + flux job attach $id || true; \ |
| 64 | + done) 2>joberr |
| 65 | +' |
| 66 | +test_expect_success 'some jobs received timeout exception' ' |
| 67 | + grep "job.exception type=timeout" joberr |
| 68 | +' |
| 69 | +test_expect_success 'no jobs received alloc-check exception' ' |
| 70 | + test_must_fail grep "job.exception type=alloc-check" joberr |
| 71 | +' |
| 72 | +test_expect_success 'remove alloc-check plugin' ' |
| 73 | + flux jobtap remove alloc-check.so |
| 74 | +' |
| 75 | +test_expect_success 'undo epilog config' ' |
| 76 | + flux config load </dev/null |
| 77 | +' |
| 78 | + |
| 79 | +test_done |
0 commit comments