BIT-1941: improve reliability of broker.disconnect unit test

This commit is contained in:
Jon Siwek 2018-07-02 16:29:21 -05:00
parent 4614dbe911
commit c9ebe725f6
11 changed files with 105 additions and 70 deletions

24
testing/scripts/wait-for-file Executable file
View file

@ -0,0 +1,24 @@
#! /usr/bin/env bash
# Sleeps until a file comes into existence.
if [[ $# -ne 2 ]]; then
>&2 echo "usage: $0 <file to wait for> <max secs to wait>"
exit 1
fi
wait_file=$1
max_wait=$2
wait_count=0
while [[ ! -e $wait_file ]]; do
let "wait_count += 1"
if [[ $wait_count -ge $max_wait ]]; then
>&2 echo "error: file '$wait_file' does not exist after $max_wait seconds"
exit 1
fi
sleep 1
done