Skip to content

Commit 218f7ec

Browse files
committed
testsuite: fix expiration propagation test
Problem: The test in t4011-match-duration.t tests that the duration of a job is inherited from the enclosing instance duration, but we should really be testing that the *expiration* of a child job is inherited from the parent when no duration is specified. O/w, a job submitted when the instance has only a few minutes remaining could have its expiration set for long after the instance is terminated. Update the test to ensure that expiration of a job with no duration specified is inherited from the enclosing instance expiration. Use flux-alloc(1) to launch the test instance instead of running standalone flux-start(1) instances since this better simulates the intended use case.
1 parent a9aabb7 commit 218f7ec

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

t/t4011-match-duration.t

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,58 @@ test_description='Test that parent duration is inherited according to RFC14'
99
#
1010
test_under_flux 1
1111

12-
test_expect_success HAVE_JQ 'parent duration is inherited when duration=0' '
12+
export FLUX_URI_RESOLVE_LOCAL=t
13+
14+
# Ensure fluxion modules are loaded under flux-alloc(1)
15+
test_expect_success 'set FLUX_RC_EXTRA so Fluxion modules are loaded under flux-alloc' '
16+
mkdir rc1.d &&
17+
cat <<-EOF >rc1.d/rc1-fluxion &&
18+
flux module unload -f sched-simple
19+
flux module load sched-fluxion-resource
20+
flux module load sched-fluxion-qmanager
21+
EOF
22+
mkdir rc3.d &&
23+
cat <<-EOF >rc3.d/rc3-fluxion &&
24+
flux module remove -f sched-fluxion-qmanager
25+
flux module remove -f sched-fluxion-resource
26+
flux module load sched-simple
27+
EOF
28+
chmod +x rc1.d/rc1-fluxion rc3.d/rc3-fluxion &&
29+
export FLUX_RC_EXTRA=$(pwd)
30+
'
31+
test_expect_success 'load fluxion modules in parent instance' '
32+
flux module remove sched-simple &&
33+
load_resource &&
34+
load_qmanager &&
35+
test_debug "flux dmesg -H | grep version"
36+
'
37+
test_expect_success HAVE_JQ 'parent expiration is inherited when duration=0' '
1338
cat >get_R.sh <<-EOT &&
1439
#!/bin/sh
15-
1640
flux job info \$FLUX_JOB_ID R
1741
EOT
1842
chmod +x get_R.sh &&
19-
out=$(flux run -t20s -n1 flux start flux run -n1 ./get_R.sh) &&
20-
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 20" &&
21-
out=$(flux run -t30s -n1 flux start flux run -n1 ./get_R.sh) &&
22-
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 30"
43+
jobid=$(flux alloc -n1 -t5m --bg) &&
44+
test_debug "flux proxy $jobid flux dmesg -H | grep version" &&
45+
expiration=$(flux job info $jobid R | jq .execution.expiration) &&
46+
duration=$(flux job info $jobid R \
47+
| jq ".execution | .expiration - .starttime") &&
48+
test_debug "echo expiration of alloc job is $expiration duration=$duration" &&
49+
R1=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
50+
exp1=$(echo "$R1" | jq .execution.expiration) &&
51+
d1=$(echo "$R1" | jq ".execution | .expiration - .starttime") &&
52+
test_debug "echo expiration of job is $exp1 duration=$d1" &&
53+
echo $exp1 | jq ". == $expiration" &&
54+
sleep 1 &&
55+
R2=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
56+
exp2=$(echo "$R2" | jq .execution.expiration) &&
57+
d2=$(echo "$R2" | jq ".execution | .expiration - .starttime") &&
58+
test_debug "echo expiration of second job is $exp2 duration=$d2" &&
59+
echo $exp2 | jq ". == $expiration" &&
60+
flux shutdown --quiet $jobid
61+
'
62+
test_expect_success 'unload fluxion modules' '
63+
remove_qmanager &&
64+
remove_resource
2365
'
24-
2566
test_done

0 commit comments

Comments
 (0)