Skip to content

Commit 3bea87c

Browse files
committed
testuite: update tests for new shutdown script
Problem: some tests assume that clearing the rc1/rc3 paths is sufficient to bypass all default startup and shutdown activities, but now the shutdown script path must also be cleared. Modify test scripts to take the shutdown script into consideration when modifying rc1/rc3 paths.
1 parent dfbca80 commit 3bea87c

17 files changed

+124
-85
lines changed

t/issues/t2284-initial-program-format-chars.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
for s in %h %g %%h %f; do
55
echo "Running flux broker echo $s"
6-
output=$(flux broker -Sbroker.rc1_path= -Sbroker.rc3_path= /bin/echo $s)
6+
output=$(flux broker -Sbroker.rc1_path= -Sbroker.shutdown_path= -Sbroker.rc3_path= /bin/echo $s)
77
test "$output" = "$s"
88
done
99
exit 0

t/issues/t4482-flush-list-corruption.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ chmod +x t4482.sh
3939

4040
flux start -s 1 \
4141
-o,--setattr=broker.rc1_path= \
42+
-o,--setattr=broker.shutdown_path= \
4243
-o,--setattr=broker.rc3_path= \
4344
./t4482.sh

t/t0001-basic.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ test_expect_success 'flux fortune with art works' '
132132

133133
# Minimal is sufficient for these tests, but test_under_flux unavailable
134134
# clear the RC paths
135-
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path="
135+
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=,-Sbroker.shutdown_path="
136136

137137
test_expect_success 'flux-start in exec mode works' "
138138
flux start ${ARGS} flux getattr size | grep -x 1

t/t0003-module.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ test_expect_success 'module: remove testmod if loaded' '
286286
'
287287
test_expect_success 'module: load without unload causes broker failure' '
288288
test_must_fail flux start \
289-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
289+
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=,-Sbroker.shutdown_path= \
290290
flux module load content 2>nounload.err
291291
'
292292
test_expect_success 'module: module name is called out' '

t/t0012-content-sqlite.t

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RPC=${FLUX_BUILD_DIR}/t/request/rpc
2020
SPAMUTIL="${FLUX_BUILD_DIR}/t/kvs/content-spam"
2121
rc1_kvs=$SHARNESS_TEST_SRCDIR/rc/rc1-kvs
2222
rc3_kvs=$SHARNESS_TEST_SRCDIR/rc/rc3-kvs
23+
shutdown_kvs=$SHARNESS_TEST_SRCDIR/rc/shutdown-kvs
2324

2425
test_expect_success 'load content module with lower purge/age thresholds' '
2526
flux exec flux module load content \
@@ -333,20 +334,29 @@ test_expect_success 'reload module with no options and verify modes' '
333334

334335

335336
test_expect_success 'run flux without statedir and verify modes' '
336-
flux start -o,-Sbroker.rc1_path=$rc1_kvs,-Sbroker.rc3_path=$rc3_kvs \
337+
flux start \
338+
-o,-Sbroker.rc1_path=$rc1_kvs \
339+
-o,-Sbroker.shutdown_path=$shutdown_kvs \
340+
-o,-Sbroker.rc3_path=$rc3_kvs \
337341
flux dmesg >logs3 &&
338342
grep "journal_mode=OFF synchronous=OFF" logs3
339343
'
340344
test_expect_success 'run flux with statedir and verify modes' '
341-
flux start -o,-Sbroker.rc1_path=$rc1_kvs,-Sbroker.rc3_path=$rc3_kvs \
345+
flux start \
346+
-o,-Sbroker.rc1_path=$rc1_kvs \
347+
-o,-Sbroker.shutdown_path=$shutdown_kvs \
348+
-o,-Sbroker.rc3_path=$rc3_kvs \
342349
-o,-Sstatedir=$(pwd) flux dmesg >logs4 &&
343350
grep "journal_mode=WAL synchronous=NORMAL" logs4
344351
'
345352

346353
# Will create in WAL mode since statedir is set
347354
recreate_database()
348355
{
349-
flux start -o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
356+
flux start \
357+
-o,-Sbroker.rc1_path= \
358+
-o,-Sbroker.shutdown_path= \
359+
-o,-Sbroker.rc3_path= \
350360
-o,-Sstatedir=$(pwd) bash -c \
351361
"flux module load content &&
352362
flux module load content-sqlite truncate && \
@@ -355,7 +365,10 @@ recreate_database()
355365
}
356366
load_module_xfail()
357367
{
358-
flux start -o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
368+
flux start \
369+
-o,-Sbroker.rc1_path= \
370+
-o,-Sbroker.shutdown_path= \
371+
-o,-Sbroker.rc3_path= \
359372
-o,-Sstatedir=$(pwd) bash -c \
360373
"flux module load content; \
361374
flux module load content-sqlite; \

t/t0013-config-file.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test_description='Test config file overlay bootstrap'
1010

1111

1212
# Avoid loading unnecessary modules in back to back broker tests
13-
ARGS="-Sbroker.rc1_path= -Sbroker.rc3_path="
13+
ARGS="-Sbroker.rc1_path= -Sbroker.rc3_path= -Sbroker.shutdown_path="
1414

1515
# This option is compiled out of flux if zeromq is too old
1616
if flux broker ${ARGS} flux getattr tbon.tcp_user_timeout >/dev/null 2>&1; then
@@ -227,6 +227,7 @@ test_expect_success 'start size=2 instance with ipc://' '
227227
EOT
228228
flux start -s2 --test-hosts=fake[0-1] \
229229
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
230+
-o,-Sbroker.shutdown_path= \
230231
-o,--config-path=conf8 \
231232
./attrdump.sh >ipc.out &&
232233
cat <<-EXP >ipc.exp &&
@@ -257,6 +258,7 @@ test_expect_success 'start size=3 instance with ipc:// and custom topology' '
257258
EOT
258259
flux start --test-size=3 --test-hosts=fake[0-2] \
259260
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
261+
-o,-Sbroker.shutdown_path= \
260262
-o,--config-path=conf8a \
261263
flux getattr tbon.maxlevel >conf8a.out &&
262264
echo 2 >conf8a.exp &&
@@ -288,8 +290,8 @@ test_expect_success NO_CHAIN_LINT 'a warning is printed when upstream URI has un
288290
host = "fake1"
289291
EOT
290292
FLUX_FAKE_HOSTNAME=fake1 \
291-
flux broker -vv -Sbroker.rc1_path=,-Sbroker.rc3_path= \
292-
--config-path=conf8b 2>warn.err &
293+
flux broker -vv -Sbroker.rc1_path= -Sbroker.rc3_path= \
294+
-Sbroker.shutdown_path= --config-path=conf8b 2>warn.err &
293295
echo $! >warn.pid &&
294296
waitgrep "unable to resolve upstream peer" warn.err 30
295297
'
@@ -325,6 +327,7 @@ test_expect_success 'start size=4 instance with tcp://' '
325327
EOT
326328
flux start -s4 --test-hosts=fake[0-3] \
327329
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
330+
-o,-Sbroker.shutdown_path= \
328331
-o,--config-path=conf9 \
329332
./attrdump.sh >tcp.out &&
330333
cat <<-EXP >tcp.exp &&

t/t0014-runlevel.t

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ test -n "$FLUX_TESTS_LOGFILE" && set -- "$@" --logfile --debug
1010

1111
test_expect_success 'initial program is run when rc1/rc3 are nullified' '
1212
flux start -o,-Slog-stderr-level=6 \
13-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
13+
-o,-Sbroker.rc1_path= \
14+
-o,-Sbroker.rc3_path= \
15+
-o,-Sbroker.shutdown_path= \
1416
/bin/true 2>normal.log
1517
'
1618

1719
test_expect_success 'rc1 failure causes instance failure' '
1820
test_expect_code 1 flux start \
19-
-o,-Sbroker.rc1_path=/bin/false,-Sbroker.rc3_path= \
21+
-o,-Sbroker.rc1_path=/bin/false \
22+
-o,-Sbroker.rc3_path= \
23+
-o,-Sbroker.shutdown_path= \
2024
-o,-Slog-stderr-level=6 \
2125
sleep 3600 2>rc1_failure.log
2226
'
@@ -25,7 +29,9 @@ test_expect_success 'rc1 bad path handled same as failure' '
2529
(
2630
SHELL=/bin/sh &&
2731
test_expect_code 127 flux start \
28-
-o,-Sbroker.rc1_path=rc1-nonexist,-Sbroker.rc3_path= \
32+
-o,-Sbroker.rc1_path=rc1-nonexist \
33+
-o,-Sbroker.rc3_path= \
34+
-o,-Sbroker.shutdown_path= \
2935
-o,-Slog-stderr-level=6 \
3036
/bin/true 2>bad1.log
3137
)
@@ -35,15 +41,20 @@ test_expect_success 'default initial program is $SHELL' '
3541
run_timeout --env=SHELL=/bin/sh 60 \
3642
flux $SHARNESS_TEST_SRCDIR/scripts/runpty.py -i none \
3743
flux start -o,-Slog-stderr-level=6 \
38-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
44+
-o,-Sbroker.rc1_path= \
45+
-o,,-Sbroker.rc3_path= \
46+
-o,,-Sbroker.shutdown_path= \
3947
>shell.log &&
4048
grep "rc2.0: /bin/sh Exited" shell.log
4149
'
4250

4351
test_expect_success 'rc2 failure if stdin not a tty' '
4452
test_expect_code 1 \
45-
flux start -o,-Slog-stderr-level=6 \
46-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
53+
flux start \
54+
-o,-Slog-stderr-level=6 \
55+
-o,-Sbroker.rc1_path= \
56+
-o,-Sbroker.rc3_path= \
57+
-o,-Sbroker.shutdown_path= \
4758
2>shell-notty.log &&
4859
grep "not a tty" shell-notty.log
4960
'
@@ -59,67 +70,46 @@ test_expect_success 'broker.rc2_none terminates by signal without error' '
5970
for timeout in 0.5 1 2 4; do
6071
run_timeout -s ALRM $timeout flux start \
6172
-o,-Slog-stderr-level=6 \
62-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=,-Sbroker.rc2_none &&
73+
-o,-Sbroker.rc1_path= \
74+
-o,-Sbroker.rc3_path= \
75+
-o,-Sbroker.shutdown_path= \
76+
-o,-Sbroker.rc2_none &&
6377
break
6478
done
6579
'
6680

67-
test_expect_success 'flux admin cleanup-push /bin/true works' '
81+
test_expect_success 'shutdown=/bin/true works' '
6882
flux start -o,-Slog-stderr-level=6 \
69-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
70-
flux admin cleanup-push /bin/true
71-
'
72-
73-
test_expect_success 'flux admin cleanup-push /bin/false causes instance failure' '
74-
test_expect_code 1 flux start -o,-Slog-stderr-level=6 \
75-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
76-
flux admin cleanup-push /bin/false
77-
'
78-
79-
test_expect_success 'cleanup does not run if rc1 fails' '
80-
test_expect_code 1 flux start -o,-Slog-stderr-level=6 \
81-
-o,-Sbroker.rc1_path=/bin/false,-Sbroker.rc3_path= \
82-
flux admin cleanup-push memorable-string 2>nocleanup.err && \
83-
test_must_fail grep memorable-string nocleanup.err
83+
-o,-Sbroker.rc1_path= \
84+
-o,-Sbroker.rc3_path= \
85+
-o,-Sbroker.shutdown_path=/bin/true \
86+
/bin/true
8487
'
85-
86-
test_expect_success 'flux admin cleanup-push (empty) fails' '
88+
test_expect_success 'shutdown=/bin/false causes instance failure' '
8789
test_expect_code 1 flux start \
88-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
89-
flux admin cleanup-push "" 2>push.err &&
90-
grep "cannot push an empty command line" push.err
90+
-o,-Slog-stderr-level=6 \
91+
-o,-Sbroker.rc1_path= \
92+
-o,-Sbroker.rc3_path= \
93+
-o,-Sbroker.shutdown_path=/bin/false \
94+
/bin/true
9195
'
9296

93-
test_expect_success 'flux admin cleanup-push with no commands fails' '
97+
test_expect_success 'shutdown does not run if rc1 fails' '
9498
test_expect_code 1 flux start \
95-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
96-
flux admin cleanup-push </dev/null 2>push2.err &&
97-
grep "commands array is empty" push2.err
98-
'
99-
100-
test_expect_success 'flux admin cleanup-push (stdin) works' '
101-
echo /bin/true | flux start -o,-Slog-stderr-level=6 \
102-
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
103-
flux admin cleanup-push 2>push-stdin.err &&
104-
grep cleanup.0 push-stdin.err
105-
'
106-
107-
test_expect_success 'flux admin cleanup-push (stdin) retains cmd block order' '
108-
flux start -o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
10999
-o,-Slog-stderr-level=6 \
110-
flux admin cleanup-push <<-EOT 2>hello.err &&
111-
echo Hello world
112-
echo Hello solar system
113-
EOT
114-
grep "cleanup.0: Hello world" hello.err &&
115-
grep "cleanup.1: Hello solar system" hello.err
100+
-o,-Sbroker.rc1_path=/bin/false \
101+
-o,-Sbroker.rc3_path= \
102+
-o,-Sbroker.shutdown_path=memorable-string \
103+
/bin/true 2>nocleanup.err &&
104+
test_must_fail grep memorable-string nocleanup.err
116105
'
117106

118-
test_expect_success 'capture the environment for all three rc scripts' '
107+
test_expect_success 'capture the environment for all rc scripts' '
119108
SLURM_FOO=42 flux start \
120109
-o,-Slog-stderr-level=6 \
121110
-o,-Sbroker.rc1_path="bash -c printenv >rc1.env" \
122111
-o,-Sbroker.rc3_path="bash -c printenv >rc3.env" \
112+
-o,-Sbroker.shutdown_path="bash -c printenv >shutdown.env" \
123113
"bash -c printenv >rc2.env"
124114
'
125115

@@ -166,6 +156,7 @@ test_expect_success 'capture the environment for instance run as a job' '
166156
-o,-Slog-stderr-level=6 \
167157
-o,-Sbroker.rc1_path="bash -c printenv >rc1.env2" \
168158
-o,-Sbroker.rc3_path="bash -c printenv >rc3.env2" \
159+
-o,-Sbroker.shutdown_path="bash -c printenv >shutdown.env2" \
169160
"bash -c printenv >rc2.env2"
170161
'
171162

t/t0024-content-s3.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,14 @@ EOF
349349
test_expect_success 'run instance with content-s3 module loaded' '
350350
flux start -o,--setattr=broker.rc1_path=$(pwd)/rc1-content-s3 \
351351
-o,--setattr=broker.rc3_path=$(pwd)/rc3-content-s3 \
352+
-o,--setattr=broker.shutdown_path= \
352353
flux kvs put testkey=43
353354
'
354355

355356
test_expect_success 're-run instance with content-s3 module loaded' '
356357
flux start -o,--setattr=broker.rc1_path=$(pwd)/rc1-content-s3 \
357358
-o,--setattr=broker.rc3_path=$(pwd)/rc3-content-s3 \
359+
-o,--setattr=broker.shutdown_path= \
358360
flux kvs get testkey >gets3.out
359361
'
360362

@@ -366,6 +368,7 @@ test_expect_success 'content from previous instance survived (s3)' '
366368
test_expect_success 're-run instance, verify checkpoint date saved (s3)' '
367369
flux start -o,--setattr=broker.rc1_path=$(pwd)/rc1-content-s3 \
368370
-o,--setattr=broker.rc3_path=$(pwd)/rc3-content-s3 \
371+
-o,--setattr=broker.shutdown_path= \
369372
flux dmesg >dmesgs3.out
370373
'
371374

t/t0025-broker-state-machine.t

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test -n "$FLUX_TESTS_LOGFILE" && set -- "$@" --logfile
99

1010
RPC=${FLUX_BUILD_DIR}/t/request/rpc
1111
SRPC=${FLUX_BUILD_DIR}/t/request/rpc_stream
12-
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path="
12+
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=,-Sbroker.shutdown_path="
1313
GROUPSCMD="flux python ${SHARNESS_TEST_SRCDIR}/scripts/groups.py"
1414

1515
test_expect_success 'quorum reached on instance with 1 TBON level' '
@@ -83,6 +83,7 @@ test_expect_success 'instance functions with late-joiner' '
8383
flux start -s2 \
8484
-o,-Slog-stderr-level=6 \
8585
-o,-Sbroker.rc1_path="$(pwd)/rc1_block" \
86+
-o,-Sbroker.shutdown_path= \
8687
-o,-Sbroker.rc3_path= \
8788
-o,-Sbroker.quorum=1 \
8889
$(pwd)/rc2_unblock >late.out &&
@@ -115,6 +116,7 @@ test_expect_success 'monitor reports INIT(2) in rc1' '
115116
echo 2 >rc1.exp &&
116117
flux start \
117118
-o,-Sbroker.rc1_path=$(pwd)/rc_getstate \
119+
-o,-Sbroker.shutdown_path= \
118120
-o,-Sbroker.rc3_path= \
119121
/bin/true &&
120122
test_cmp rc1.exp rc.out
@@ -124,24 +126,27 @@ test_expect_success 'monitor reports RUN(4) in rc2' '
124126
echo 4 >rc2.exp &&
125127
flux start \
126128
-o,-Sbroker.rc1_path= \
129+
-o,-Sbroker.shutdown_path= \
127130
-o,-Sbroker.rc3_path= \
128131
$(pwd)/rc_getstate &&
129132
test_cmp rc2.exp rc.out
130133
'
131134

132-
test_expect_success 'monitor reports CLEANUP(5) in cleanup script' '
135+
test_expect_success 'monitor reports CLEANUP(5) in shutdown script' '
133136
echo 5 >cleanup.exp &&
134137
flux start \
135138
-o,-Sbroker.rc1_path= \
139+
-o,-Sbroker.shutdown_path=$(pwd)/rc_getstate \
136140
-o,-Sbroker.rc3_path= \
137-
bash -c "echo $(pwd)/rc_getstate | flux admin cleanup-push" &&
141+
/bin/true &&
138142
test_cmp cleanup.exp rc.out
139143
'
140144

141145
test_expect_success 'monitor reports FINALIZE(7) in rc3' '
142146
echo 7 >rc3.exp &&
143147
flux start \
144148
-o,-Sbroker.rc1_path= \
149+
-o,-Sbroker.shutdown_path= \
145150
-o,-Sbroker.rc3_path=$(pwd)/rc_getstate \
146151
/bin/true &&
147152
test_cmp rc3.exp rc.out
@@ -232,6 +237,7 @@ test_expect_success 'capture state transitions from instance with rc3 failure' '
232237
test_expect_code 1 flux start \
233238
-o,-Slog-filename=states_rc3.log \
234239
-o,-Sbroker.rc1_path= \
240+
-o,-Sbroker.shutdown_path= \
235241
-o,-Sbroker.rc3_path=/bin/false \
236242
/bin/true
237243
'

t/t2004-hydra.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test_description='Test that MPICH Hydra can launch Flux'
77
test -n "$FLUX_TESTS_LOGFILE" && set -- "$@" --logfile
88
. `dirname $0`/sharness.sh
99
PMI_INFO=${FLUX_BUILD_DIR}/src/common/libpmi/test_pmi_info
10-
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path="
10+
ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=,-Sbroker.shutdown_path="
1111

1212
if ! which mpiexec.hydra 2>/dev/null; then
1313
skip_all='skipping hydra-launching-flux tests, mpiexec.hydra unavailable'

0 commit comments

Comments
 (0)