1278d067ef
- Creates a new tox environment for testing against mysql - Adds a script set-test-env-mysql.sh to set up mysql - Adds a new file `functions.sh` for common shell functions - Creates a new DB manager for tests - Adds a new scenario for mysql in the MixinTestsWithBackendScenarios Related to blueprint sql-unit-tests-on-real-backend Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com> Change-Id: I2c7378c79b1a0bffae5b2489b04c60e509f62f85
31 lines
908 B
Bash
Executable File
31 lines
908 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/CEILO-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 CEILOMETER_TEST_MYSQL_URL="mysql://root@localhost/ceilometer?unix_socket=${MYSQL_DATA}/mysql.socket&charset=utf8"
|
|
|
|
mysql -S ${MYSQL_DATA}/mysql.socket -e 'CREATE DATABASE ceilometer;'
|
|
|
|
# Yield execution to venv command
|
|
$*
|