Initial database support
This adds a database connection for testing, which will be required in 4.0+. Change-Id: I3c9ba6aac023a0018d857bd3d34f54cdc26e4b79 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
b39e9df5f5
commit
8ca94ef268
|
@ -5,6 +5,8 @@ git
|
|||
libffi-dev [platform:dpkg]
|
||||
libffi-devel [platform:rpm]
|
||||
libssl-dev [platform:dpkg]
|
||||
mysql-client [test !platform:rpm]
|
||||
mysql-server [test]
|
||||
openssl-devel [platform:rpm]
|
||||
python3-dnf [platform:fedora]
|
||||
python3-libselinux [platform:rpm]
|
||||
|
|
|
@ -42,3 +42,7 @@ zuul_url = 127.0.0.1
|
|||
[web]
|
||||
log_config = /etc/zuul/web-logging.conf
|
||||
listen_address = 127.0.0.1
|
||||
|
||||
[connection database]
|
||||
driver = sql
|
||||
dburi = mysql+pymysql://zuul:secret@127.0.0.1/zuul
|
||||
|
|
|
@ -42,3 +42,7 @@
|
|||
- name: Use the latest version of pip
|
||||
become: true
|
||||
shell: python3 -m pip install -U pip
|
||||
|
||||
- name: Execute test-setup role
|
||||
include_role:
|
||||
name: test-setup
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash -ex
|
||||
# Copyright 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Be sure mysql is started.
|
||||
sudo service mysql start
|
||||
|
||||
# The root password for the MySQL database; pass it in via
|
||||
# MYSQL_ROOT_PW.
|
||||
DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_worker}
|
||||
|
||||
# This user and its password are used by the tests, if you change it,
|
||||
# your tests might fail.
|
||||
DB_USER=zuul
|
||||
DB_PW=secret
|
||||
|
||||
sudo -H mysqladmin -u root password $DB_ROOT_PW
|
||||
|
||||
# It's best practice to remove anonymous users from the database. If
|
||||
# a anonymous user exists, then it matches first for connections and
|
||||
# other connections from that host will not work.
|
||||
sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e "
|
||||
DELETE FROM mysql.user WHERE User='';
|
||||
FLUSH PRIVILEGES;
|
||||
CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PW';
|
||||
GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%' WITH GRANT OPTION;"
|
||||
|
||||
# Now create our database.
|
||||
mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e "
|
||||
SET default_storage_engine=MYISAM;
|
||||
DROP DATABASE IF EXISTS zuul;
|
||||
CREATE DATABASE zuul CHARACTER SET utf8;"
|
Loading…
Reference in New Issue