aodh/setup-test-env-mongodb.sh
Julien Danjou 59e3389655 tests: remove testscenarios usage
We actually do not run the tests with different backend at the same
time, so there's no need for scenarios.

Change-Id: I2cc7aaee04834d1949bdb3c547f0d5b893d13aef
2015-11-10 09:10:16 +01:00

28 lines
841 B
Bash
Executable File

#!/bin/bash
set -e
source functions.sh
if [ "$1" = "--coverage" ]; then
COVERAGE_ARG="$1"
shift
fi
export PATH=${PATH:+$PATH:}/sbin:/usr/sbin
check_for_cmd mongod
# Start MongoDB process for tests
MONGO_DATA=`mktemp -d /tmp/AODH-MONGODB-XXXXX`
MONGO_PORT=29000
trap "clean_exit ${MONGO_DATA}" EXIT
mkfifo ${MONGO_DATA}/out
mongod --maxConns 32 --nojournal --noprealloc --smallfiles --quiet --noauth --port ${MONGO_PORT} --dbpath "${MONGO_DATA}" --bind_ip localhost --config /dev/null &>${MONGO_DATA}/out &
# Wait for Mongo to start listening to connections
wait_for_line "waiting for connections on port ${MONGO_PORT}" ${MONGO_DATA}/out
# Read the fifo for ever otherwise mongod would block
cat ${MONGO_DATA}/out > /dev/null &
export AODH_TEST_STORAGE_URL="mongodb://localhost:${MONGO_PORT}/AODH"
# Yield execution to venv command
$*