Browse Source

Merge "Add dockerized test setup"

changes/74/637974/1
Zuul 2 years ago
committed by Gerrit Code Review
parent
commit
40feb0a13d
2 changed files with 55 additions and 0 deletions
  1. +35
    -0
      tools/docker-compose.yaml
  2. +20
    -0
      tools/test-setup-docker.sh

+ 35
- 0
tools/docker-compose.yaml View File

@ -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

+ 20
- 0
tools/test-setup-docker.sh View File

@ -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"

Loading…
Cancel
Save