Skip to content

Commit

Permalink
t/t1004-kvs-namespace.t: Minor cleanup
Browse files Browse the repository at this point in the history
Use KVS_WAIT_ITERS instead of hard coding 50 and general
code cleanup.
  • Loading branch information
chu11 committed Jan 3, 2018
1 parent 3ea916a commit c573747
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions t/t1004-kvs-namespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dir_kvs_namespace_exitvalue() {

namespace_create_loop() {
i=0
while ! flux kvs namespace-create $1 && [ $i -lt 50 ]
while ! flux kvs namespace-create $1 && [ $i -lt ${KVS_WAIT_ITERS} ]
do
sleep 0.1
i=$((i + 1))
Expand All @@ -100,7 +100,8 @@ namespace_create_loop() {

get_kvs_namespace_all_ranks_loop() {
i=0
while ! flux exec sh -c "export FLUX_KVS_NAMESPACE=$1; flux kvs get $2" && [ $i -lt 50 ]
while ! flux exec sh -c "export FLUX_KVS_NAMESPACE=$1; flux kvs get $2" \
&& [ $i -lt ${KVS_WAIT_ITERS} ]
do
sleep 0.1
i=$((i + 1))
Expand All @@ -110,7 +111,8 @@ get_kvs_namespace_all_ranks_loop() {

get_kvs_namespace_fails_all_ranks_loop() {
i=0
while ! flux exec sh -c "export FLUX_KVS_NAMESPACE=$1; ! flux kvs get $2" && [ $i -lt 50 ]
while ! flux exec sh -c "export FLUX_KVS_NAMESPACE=$1; ! flux kvs get $2" \
&& [ $i -lt ${KVS_WAIT_ITERS} ]
do
sleep 0.1
i=$((i + 1))
Expand All @@ -121,7 +123,8 @@ get_kvs_namespace_fails_all_ranks_loop() {
wait_watch_put_namespace() {
export FLUX_KVS_NAMESPACE=$1
i=0
while [ "$(flux kvs get --json $2 2> /dev/null)" != "$3" ] && [ $i -lt 50 ]
while [ "$(flux kvs get --json $2 2> /dev/null)" != "$3" ] \
&& [ $i -lt ${KVS_WAIT_ITERS} ]
do
sleep 0.1
i=$((i + 1))
Expand All @@ -132,7 +135,8 @@ wait_watch_put_namespace() {

wait_fencecount_nonzero() {
i=0
while [ "$(flux exec -r $1 sh -c "flux module stats --parse namespace.$2.#fences kvs" 2> /dev/null)" == "0" ] && [ $i -lt 50 ]
while [ "$(flux exec -r $1 sh -c "flux module stats --parse namespace.$2.#fences kvs" 2> /dev/null)" == "0" ] \
&& [ $i -lt ${KVS_WAIT_ITERS} ]
do
sleep 0.1
i=$((i + 1))
Expand Down

0 comments on commit c573747

Please sign in to comment.