diff options
author | Tobias Henkel <tobias.henkel@bmw.de> | 2019-02-12 20:02:18 +0100 |
---|---|---|
committer | Tobias Henkel <tobias.henkel@bmw.de> | 2019-02-15 07:54:28 +0100 |
commit | c493af17552e1a9e549e4ebf0255d6e775eec9a1 (patch) | |
tree | 47a9ffa6bf54543b808a10237b791324a0b71969 /tools | |
parent | 6d6c69f93e9755b3b812c85ffceb1b830bd75d6f (diff) | |
download | zuul-c493af17552e1a9e549e4ebf0255d6e775eec9a1.tar.gz |
Add dockerized test setup
We currently have the test-setup.sh script that installs and
configures the services that are needed to run the zuul test
suite. However this needs mysql, postgres and zookeeper installed into
the system. It also messes with tmpfs mounts of zookeeper. This adds a
docker-compose based test setup that can ease the setup of the test
requirements on a developer machine.
Change-Id: Ib0e3f42898c6e9258625b03bcc363e91f4b7ee83
Diffstat (limited to 'tools')
-rw-r--r-- | tools/docker-compose.yaml | 35 | ||||
-rwxr-xr-x | tools/test-setup-docker.sh | 20 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tools/docker-compose.yaml b/tools/docker-compose.yaml new file mode 100644 index 000000000..e826a3fb8 --- /dev/null +++ b/tools/docker-compose.yaml @@ -0,0 +1,35 @@ +version: "3" + +services: + mysql: + container_name: zuul-test-mysql + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=insecure_slave + ports: + - "3306:3306" + tmpfs: + - /var/lib/mysql + + postgres: + container_name: zuul-test-postgres + image: postgres + environment: + - POSTGRES_USER=openstack_citest + - POSTGRES_PASSWORD=openstack_citest + ports: + - "5432:5432" + tmpfs: + - /var/lib/postgresql/data + + zookeeper: + container_name: zuul-test-zookeeper + image: zookeeper + environment: + - ZOO_AUTOPURGE_PURGEINTERVAL=1 + - ZOO_LOG4J_PROP=WARN + ports: + - "2181:2181" + tmpfs: + - /data + - /datalog diff --git a/tools/test-setup-docker.sh b/tools/test-setup-docker.sh new file mode 100755 index 000000000..6e28aa3ec --- /dev/null +++ b/tools/test-setup-docker.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -eu + +cd $(dirname $0) + +MYSQL="docker exec zuul-test-mysql mysql -u root -pinsecure_slave" + +docker-compose rm -sf +docker-compose up -d + +echo "Waiting for mysql" +timeout 30 bash -c "until ${MYSQL} -e 'show databases'; do sleep 0.5; done" +echo + +echo "Setting up permissions for zuul tests" +${MYSQL} -e "GRANT ALL PRIVILEGES ON *.* TO 'openstack_citest'@'%' identified by 'openstack_citest' WITH GRANT OPTION;" +${MYSQL} -u openstack_citest -popenstack_citest -e "SET default_storage_engine=MYISAM; DROP DATABASE IF EXISTS openstack_citest; CREATE DATABASE openstack_citest CHARACTER SET utf8;" + +echo "Finished" |