Skip to content

Commit

Permalink
testsuite: update flux-start usage
Browse files Browse the repository at this point in the history
Problem: Throughout the testsuite `-o-Sattr=val` and `-o,-cPATH`
are used to pass broker attributes and config-path to Flux brokers,
but this level of indirection is no longer necessary since flux-start
supports `-S, --setattr` and `-c, --config-path` options.

Update the testsuite to use `flux start` `-S, --setattr` and `-c,
--config-path` options where it makes sense.
  • Loading branch information
grondo committed Nov 21, 2024
1 parent 7e89c3b commit 89c2016
Show file tree
Hide file tree
Showing 49 changed files with 386 additions and 381 deletions.
2 changes: 1 addition & 1 deletion t/fluxometer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function fluxTest.init (...)
end

test.log_file = "lua-"..test.prog..".broker.log"
test.start_args = { "-o,-Slog-filename=" .. test.log_file }
test.start_args = { "-Slog-filename=" .. test.log_file }

local path = fluxTest.fluxbindir .. "/flux"
local mode = posix.stat (path, 'mode')
Expand Down
2 changes: 1 addition & 1 deletion t/issues/t3906-job-exec-exception.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 3. Ensure job exception is raised and includes appropriate error note
#
export startctl="flux python ${SHARNESS_TEST_SRCDIR}/scripts/startctl.py"
SHELL=/bin/sh flux start -s 4 -o,-Stbon.topo=kary:4 --test-exit-mode=leader '\
SHELL=/bin/sh flux start -s 4 -Stbon.topo=kary:4 --test-exit-mode=leader '\
id=$(flux submit -n4 -N4 sleep 300) \
&& flux job wait-event $id start \
&& $startctl kill 3 9 \
Expand Down
2 changes: 1 addition & 1 deletion t/issues/t3960-job-exec-ehostunreach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
#
export startctl="flux python ${SHARNESS_TEST_SRCDIR}/scripts/startctl.py"
SHELL=/bin/sh flux start -s 4 -o,-Stbon.topo=kary:4 --test-exit-mode=leader '\
SHELL=/bin/sh flux start -s 4 -Stbon.topo=kary:4 --test-exit-mode=leader '\
id=$(flux submit -n4 -N4 sleep 300) \
&& flux job wait-event $id start \
&& $startctl kill 3 19 \
Expand Down
2 changes: 1 addition & 1 deletion t/issues/t4182-resource-rerank.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ echo "resource.noverify = true" >t4182-resource.toml
# ensure R rerank failure is ignored (i.e. job completes successfully)
flux run -o per-resource.type=node -o cpu-affinity=off -n 11 \
flux start -o,--config-path=t4182-resource.toml \
flux start --config-path=t4182-resource.toml \
flux getattr hostlist
# ensure R is reranked based on hostlist attribute:
Expand Down
4 changes: 2 additions & 2 deletions t/issues/t4465-job-list-use-after-free.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ mkdir ${STATEDIR}
# a different order than submitted, hence number of jobs submitted equals
# number of broker ranks.
#
flux start --test-size=8 -o,-Sstatedir=${STATEDIR} \
flux start --test-size=8 -Sstatedir=${STATEDIR} \
bash -c "flux submit --cc 1-8 --quiet /bin/true && flux queue drain"

flux start --test-size=1 -o,-Sstatedir=${STATEDIR} \
flux start --test-size=1 -Sstatedir=${STATEDIR} \
--wrap=libtool,e,${VALGRIND} \
--wrap=--tool=memcheck \
--wrap=--trace-children=no \
Expand Down
4 changes: 2 additions & 2 deletions t/issues/t4482-flush-list-corruption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ EOF
chmod +x t4482.sh

flux start -s 1 \
-o,--setattr=broker.rc1_path= \
-o,--setattr=broker.rc3_path= \
--setattr=broker.rc1_path= \
--setattr=broker.rc3_path= \
./t4482.sh
2 changes: 1 addition & 1 deletion t/issues/t4583-free-range-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if test "$FREE_RANGE_TEST_ACTIVE" != "t"; then
exec flux start -s 4 \
--test-exit-mode=leader \
--test-pmi-clique=per-broker \
-o -Stbon.topo=kary:0 $0
-Stbon.topo=kary:0 $0
fi

# Start a job with tbon.topo=kary:0
Expand Down
4 changes: 2 additions & 2 deletions t/issues/t4852-t_submit-legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ STATEDIR=issue4852-statedir
mkdir issue4852-statedir

flux start -s 1 \
-o,--setattr=statedir=${STATEDIR} \
--setattr=statedir=${STATEDIR} \
./t4852setup.sh

flux start -s 1 \
-o,--setattr=statedir=${STATEDIR} \
--setattr=statedir=${STATEDIR} \
./t4852test.sh
2 changes: 1 addition & 1 deletion t/issues/t5892-shutdown-no-epilog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins = [
command = [ "touch", "t5892-epilog-flag" ]
EOF

flux start -o,--config-path=t5892.toml \
flux start --config-path=t5892.toml \
flux submit sleep inf

rc=0
Expand Down
4 changes: 2 additions & 2 deletions t/python/subflux.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def rerun_under_flux(size=1, personality="full"):
for rc_num in [1, 3]:
attr = "broker.rc{}_path".format(rc_num)
if personality == "minimal":
command.append("-o,-S{}=".format(attr))
command.append("-S{}=".format(attr))
else:
path = "{}/t/rc/rc{}-{}".format(srcdir, rc_num, personality)
command.append("-o,-S{}={}".format(attr, path))
command.append("-S{}={}".format(attr, path))
if not is_exe(path):
print("cannot execute {}".format(path), file=sys.stderr)
sys.exit(1)
Expand Down
12 changes: 6 additions & 6 deletions t/sharness.d/flux-sharness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ make_bootstrap_config() {
path = "$workdir/R"
noverify = true
EOT2
echo "--test-hosts=$fakehosts -o,-c$workdir/conf.d"
echo "--test-hosts=$fakehosts -c$workdir/conf.d"
echo "--test-exit-mode=${TEST_UNDER_FLUX_EXIT_MODE:-leader}"
echo "--test-exit-timeout=${TEST_UNDER_FLUX_EXIT_TIMEOUT:-0}"
echo "-o,-Sbroker.quorum=${TEST_UNDER_FLUX_QUORUM:-$size}"
echo "-Sbroker.quorum=${TEST_UNDER_FLUX_QUORUM:-$size}"
echo "--test-start-mode=${TEST_UNDER_FLUX_START_MODE:-all}"
echo "-o,-Stbon.topo=${TEST_UNDER_FLUX_TOPO:-custom}"
echo "-o,-Stbon.zmqdebug=1"
echo "-o,-Sstatedir=$workdir/state"
echo "-Stbon.topo=${TEST_UNDER_FLUX_TOPO:-custom}"
echo "-Stbon.zmqdebug=1"
echo "-Sstatedir=$workdir/state"
}

#
Expand Down Expand Up @@ -263,7 +263,7 @@ test_under_flux() {
# Set log_path for ASan o/w errors from broker may be lost
ASAN_OPTIONS=${ASAN_OPTIONS}:log_path=${TEST_NAME}.asan
fi
logopts="-o -Slog-filename=${log_file},-Slog-forward-level=7"
logopts="-o -Slog-filename=${log_file} -Slog-forward-level=7"
TEST_UNDER_FLUX_ACTIVE=t \
TERM=${ORIGINAL_TERM} \
TEST_UNDER_FLUX_PERSONALITY="${personality:-default}" \
Expand Down
48 changes: 26 additions & 22 deletions t/t0001-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test_expect_success 'flux fortune with art works' '

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

test_expect_success 'flux-start in exec mode works' "
flux start ${ARGS} flux getattr size | grep -x 1
Expand All @@ -168,15 +168,15 @@ test_expect_success 'and broker.boot-method=simple' "
flux getattr broker.boot-method) = "simple"
"
test_expect_success 'although method can be forced to single with attribute' "
test $(flux start ${ARGS} -s1 -o,-Sbroker.boot-method=single \
test $(flux start ${ARGS} -s1 -Sbroker.boot-method=single \
flux getattr broker.boot-method) = "single"
"
test_expect_success 'or forced by setting FLUX_PMI_CLIENT_METHODS' "
test $(FLUX_PMI_CLIENT_METHODS="single" flux start ${ARGS} -s1 \
flux getattr broker.boot-method) = "single"
"
test_expect_success 'start fails when broker.boot-method=unknown' "
test_must_fail flux start ${ARGS} -o,-Sbroker.boot-method=unknown \
test_must_fail flux start ${ARGS} -Sbroker.boot-method=unknown \
/bin/true
"
test_expect_success 'flux-start in subprocess/pmi mode works (size 2)' "
Expand Down Expand Up @@ -347,7 +347,7 @@ test_expect_success 'flux-start works with multiple files in rc1.d' '
printf "echo rc-one\n" >rc1.d/one &&
printf "echo rc-two\n" >rc1.d/two &&
chmod +x rc1.d/* &&
FLUX_RC_EXTRA=$(pwd) flux start -o-Slog-stderr-level=6 \
FLUX_RC_EXTRA=$(pwd) flux start -Slog-stderr-level=6 \
echo rc-three >rc-multi.out 2>&1 &&
test_debug "cat rc-multi.out" &&
grep rc-one rc-multi.out &&
Expand Down Expand Up @@ -394,7 +394,7 @@ test_expect_success HWLOC_LS 'FLUX_HWLOC_XMLFILE works' '
norestrict = true
EOF
FLUX_HWLOC_XMLFILE=test.xml \
flux start -s2 -o,--conf=norestrict.conf \
flux start -s2 --conf=norestrict.conf \
flux resource info >rinfo.out &&
test_debug "cat rinfo.out" &&
grep "12 Cores" rinfo.out
Expand Down Expand Up @@ -427,6 +427,10 @@ test_expect_success 'flux-start -o,--setattr ATTR=VAL can set broker attributes'
ATTR_VAL=`flux start ${ARGS} -o,--setattr=foo-test=42 flux getattr foo-test` &&
test $ATTR_VAL -eq 42
'
test_expect_success 'flux-start --setattr ATTR=VAL can set broker attributes' '
ATTR_VAL=`flux start ${ARGS} --setattr=foo-test=42 flux getattr foo-test` &&
test $ATTR_VAL -eq 42
'
test_expect_success 'hostlist attr is set on size 1 instance' '
hn=$(hostname) &&
cat >hostlist1.exp <<-EOT &&
Expand Down Expand Up @@ -492,15 +496,15 @@ test_expect_success 'flux start --test-rundir with not-directory fails' '
'
test_expect_success 'rundir override works' '
RUNDIR=`mktemp -d` &&
DIR=`flux start ${ARGS} -o,--setattr=rundir=$RUNDIR flux getattr rundir` &&
DIR=`flux start ${ARGS} --setattr=rundir=$RUNDIR flux getattr rundir` &&
test "$DIR" = "$RUNDIR" &&
test -d $RUNDIR &&
rm -rf $RUNDIR
'
test_expect_success 'rundir override creates nonexistent dirs and cleans up' '
RUNDIR=`mktemp -d` &&
rmdir $RUNDIR &&
flux start ${ARGS} -o,--setattr=rundir=$RUNDIR sh -c "test -d $RUNDIR" &&
flux start ${ARGS} --setattr=rundir=$RUNDIR sh -c "test -d $RUNDIR" &&
test_expect_code 1 test -d $RUNDIR
'
test_expect_success 'broker fails gracefully when rundir buffer overflows' '
Expand All @@ -514,25 +518,25 @@ test_expect_success 'broker fails gracefully on nonexistent TMPDIR' '
'
test_expect_success 'broker fails gracefully on non-directory rundir' '
touch notdir &&
test_must_fail flux start ${ARGS} -o,-Srundir=notdir \
test_must_fail flux start ${ARGS} -Srundir=notdir \
/bin/true 2>notdir.err &&
grep "Not a directory" notdir.err
'
test_expect_success 'broker fails gracefully on unwriteable rundir' '
mkdir -p privdir &&
chmod u-w privdir &&
test_must_fail flux start ${ARGS} -o,-Srundir=privdir \
test_must_fail flux start ${ARGS} -Srundir=privdir \
/bin/true 2>privdir.err &&
grep "permissions" privdir.err
'
# statedir created here is reused in the next several tests
test_expect_success 'broker statedir is not cleaned up' '
mkdir -p statedir &&
flux start ${ARGS} -o,-Sstatedir=$(pwd)/statedir /bin/true &&
flux start ${ARGS} -Sstatedir=$(pwd)/statedir /bin/true &&
test -d statedir
'
test_expect_success 'broker statedir cannot be changed at runtime' '
test_must_fail flux start ${ARGS} -o,-Sstatedir=$(pwd)/statedir \
test_must_fail flux start ${ARGS} -Sstatedir=$(pwd)/statedir \
flux setattr statedir $(pwd)/statedir 2>rostatedir.err &&
grep "Operation not permitted" rostatedir.err
'
Expand All @@ -543,7 +547,7 @@ test_expect_success 'broker statedir cannot be set at runtime' '
'
test_expect_success 'broker fails when statedir does not exist' '
rm -rf statedir &&
test_must_fail flux start ${ARGS} -o,-Sstatedir=$(pwd)/statedir \
test_must_fail flux start ${ARGS} -Sstatedir=$(pwd)/statedir \
/bin/true 2>nostatedir.err &&
grep "cannot stat" nostatedir.err
'
Expand All @@ -559,50 +563,50 @@ test_expect_success 'local-uri override works' '
newsock=local://$sockdir/meep &&
echo $newsock >uri.exp &&
flux start ${ARGS} \
-o,-Slocal-uri=$newsock \
-Slocal-uri=$newsock \
printenv FLUX_URI >uri.out &&
test_cmp uri.exp uri.out &&
rm -rf $sockdir
'
test_expect_success 'broker fails gracefully when local-uri is malformed' '
test_must_fail flux start ${ARGS} -o,-Slocal-uri=baduri \
test_must_fail flux start ${ARGS} -Slocal-uri=baduri \
/bin/true 2>baduri.err &&
grep malformed baduri.err
'
test_expect_success 'broker fails gracefully when local-uri buffer overflows' '
longuri="local://$(head -c 1024 < /dev/zero | tr \\0 D)" &&
test_must_fail flux start ${ARGS} -o,-Slocal-uri=${longuri} \
test_must_fail flux start ${ARGS} -Slocal-uri=${longuri} \
/bin/true 2>longuri.err &&
grep "buffer overflow" longuri.err
'
test_expect_success 'broker fails gracefully when local-uri in missing dir' '
test_must_fail flux start ${ARGS} -o,-Slocal-uri=local:///noexist/x \
test_must_fail flux start ${ARGS} -Slocal-uri=local:///noexist/x \
/bin/true 2>nodiruri.err &&
grep "cannot stat" nodiruri.err
'
test_expect_success 'broker fails gracefully when local-uri in non-dir' '
touch urinotdir &&
test_must_fail flux start ${ARGS} \
-o,-Slocal-uri=local://$(pwd)/urinotdir/x \
-Slocal-uri=local://$(pwd)/urinotdir/x \
/bin/true 2>urinotdir.err &&
grep "Not a directory" urinotdir.err
'
test_expect_success 'broker fails gracefully when local-uri in unwritable dir' '
mkdir -p privdir &&
chmod u-w privdir &&
test_must_fail flux start ${ARGS} \
-o,-Slocal-uri=local://$(pwd)/privdir/x \
-Slocal-uri=local://$(pwd)/privdir/x \
/bin/true 2>uriprivdir.err &&
grep "permissions" uriprivdir.err
'
test_expect_success 'broker broker.pid attribute is immutable' '
test_must_fail flux start ${ARGS} -o,--setattr=broker.pid=1234 flux getattr broker.pid
test_must_fail flux start ${ARGS} --setattr=broker.pid=1234 flux getattr broker.pid
'
test_expect_success 'broker --verbose option works' '
flux start ${ARGS} -o,-v /bin/true
'
test_expect_success 'broker fails on invalid broker.critical-ranks option' '
test_must_fail flux start ${ARGS} -o,-Sbroker.critical-ranks=0-1
test_must_fail flux start ${ARGS} -Sbroker.critical-ranks=0-1
'
test_expect_success 'broker fails on unknown option' '
test_must_fail flux start ${ARGS} -o,--not-an-option /bin/true
Expand Down Expand Up @@ -728,7 +732,7 @@ test_expect_success 'setting rundir to a long directory fails (#3925)' '
longdir=rundir-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 &&
mkdir -p $longdir &&
test_must_fail flux start ${ARGS} \
-o,-Srundir=$longdir \
-Srundir=$longdir \
/bin/true 2>longrun.err &&
grep "exceeds max" longrun.err
'
Expand All @@ -737,7 +741,7 @@ test_expect_success 'setting local-uri to a long path fails (#3925)' '
longdir=rundir-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 &&
mkdir -p $longdir &&
test_must_fail flux start ${ARGS} \
-o,-Slocal-uri=local://$longdir/local-0 \
-Slocal-uri=local://$longdir/local-0 \
/bin/true 2>longuri.err &&
grep "exceeds max" longuri.err
'
Expand Down
3 changes: 2 additions & 1 deletion t/t0003-module.t
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ test_expect_success 'module: remove testmod if loaded' '
'
test_expect_success 'module: load without unload causes broker failure' '
test_must_fail flux start \
-o,-Sbroker.rc1_path=,-Sbroker.rc3_path= \
-Sbroker.rc1_path= \
-Sbroker.rc3_path= \
flux module load content 2>nounload.err
'
test_expect_success 'module: module name is called out' '
Expand Down
Loading

0 comments on commit 89c2016

Please sign in to comment.