deb-aodh/setup-test-env-mysql.sh
Julien Danjou f2708b4ad2 storage: always use get_connection_from_config()
There's no way to connect to a backend only using an URL, because of
parameters such as mongodb_replicaset, etc. So we just remove
get_connection(url) function and always relies on
get_connection_from_config(conf).

Change-Id: I39fabbc78325709150dc7f4edb474c7bd9501205
2015-07-28 12:34:59 +02:00

29 lines
833 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
# On systems like Fedora here's where mysqld can be found
export PATH=$PATH:/usr/libexec
check_for_cmd mysqld
# Start MySQL process for tests
MYSQL_DATA=`mktemp -d /tmp/AODH-MYSQL-XXXXX`
trap "clean_exit ${MYSQL_DATA}" EXIT
mkfifo ${MYSQL_DATA}/out
mysqld --datadir=${MYSQL_DATA} --pid-file=${MYSQL_DATA}/mysql.pid --socket=${MYSQL_DATA}/mysql.socket --skip-networking --skip-grant-tables &> ${MYSQL_DATA}/out &
# Wait for MySQL to start listening to connections
wait_for_line "mysqld: ready for connections." ${MYSQL_DATA}/out
export AODH_TEST_MYSQL_URL="mysql+pymysql://root@localhost/test?unix_socket=${MYSQL_DATA}/mysql.socket&charset=utf8"
# Yield execution to venv command
$*