Skip to content

Commit 4ec4d4d

Browse files
committed
testsuite: add sched-simple alloc check test
Problem: there is no test script specifically for checking that sched-simple does not double-book resources. Add t2304-sched-simple-alloc-check.t which uses the alloc-check.so jobtap plugin. Currently this just validates the alloc-check plugin and checks that sched-simple doesn't suffer from the same bug as flux-framework/flux-sched#1043 but other tests could be added as needed.
1 parent e99ee12 commit 4ec4d4d

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ TESTSCRIPTS = \
159159
t2300-sched-simple.t \
160160
t2302-sched-simple-up-down.t \
161161
t2303-sched-hello.t \
162+
t2304-sched-simple-alloc-check.t \
162163
t2310-resource-module.t \
163164
t2311-resource-drain.t \
164165
t2312-resource-exclude.t \

t/t2304-sched-simple-alloc-check.t

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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

Comments
 (0)