Fail tests early if mongod is not found

Instead of letting the tests report connection errors,
check for the mongod process early and don't run the
tests at all if it is not found.

Change-Id: Iebf420ba62954ffe0d2b9c23375c9a0ff9673845
This commit is contained in:
Doug Hellmann 2013-09-10 13:30:09 -04:00
parent 09e0f3fabf
commit 08eb600479
1 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,11 @@ MONGO_PORT=29000
trap "clean_exit" EXIT
mkfifo ${MONGO_DATA}/out
export PATH=${PATH:+$PATH:}/sbin:/usr/sbin
if ! which mongod >/dev/null 2>&1
then
echo "Could not find mongod command" 1>&2
exit 1
fi
mongod --maxConns 32 --nojournal --noprealloc --smallfiles --quiet --noauth --port ${MONGO_PORT} --dbpath "${MONGO_DATA}" --bind_ip localhost &>${MONGO_DATA}/out &
MONGO_PID=$!
# Wait for Mongo to start listening to connections