Skip to content

Commit 5566a59

Browse files
committed
t: cover ENOSYS on kvs module unload
Problem: There are no tests to ensure unfinished requests to the kvs module are returned ENOSYS when the module is unloaded. Add coverage in t1001-kvs-internals.t.
1 parent 643be3d commit 5566a59

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

t/t1001-kvs-internals.t

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ will generally cover non-obvious issues/features that a general user
99
would be unaware of.
1010
'
1111

12+
. `dirname $0`/kvs/kvs-helper.sh
13+
1214
. `dirname $0`/sharness.sh
1315

1416
# Size the session to one more than the number of cores, minimum of 4
@@ -511,4 +513,36 @@ test_expect_success 'kvs: test invalid lookup rpc' '
511513
grep "flux_future_get: Protocol error" lookup_invalid_output
512514
'
513515

516+
#
517+
# test ENOSYS on unfinished requests when unloading the KVS module
518+
#
519+
# N.B. do this last as we are unloading the kvs module
520+
#
521+
522+
wait_versionwaiters() {
523+
num=$1
524+
i=0
525+
while [ "$(flux module stats --parse namespace.primary.#versionwaiters kvs 2> /dev/null)" != "${num}" ] \
526+
&& [ $i -lt ${KVS_WAIT_ITERS} ]
527+
do
528+
sleep 0.1
529+
i=$((i + 1))
530+
done
531+
return $(loophandlereturn $i)
532+
}
533+
534+
# In order to test, wait for a version that will not happen
535+
test_expect_success NO_CHAIN_LINT 'kvs: ENOSYS returned on unfinished requests on module unload' '
536+
WAITCOUNT=$(flux module stats --parse namespace.primary.#versionwaiters kvs) &&
537+
WAITCOUNT=$(($WAITCOUNT+1))
538+
VERS=$(flux kvs version) &&
539+
VERSWAIT=$(($VERS+10)) &&
540+
flux kvs wait ${VERSWAIT} 2> enosys.err &
541+
pid=$! &&
542+
wait_versionwaiters ${WAITCOUNT} &&
543+
flux module remove kvs &&
544+
! wait $pid &&
545+
grep "Function not implemented" enosys.err
546+
'
547+
514548
test_done

0 commit comments

Comments
 (0)