blob: d3697c9b41f61fffcbf9255290eae6d8d48c04a3 [file] [log] [blame]
Joshua Heskethd78b4482015-09-14 16:56:34 -06001#!/bin/bash -xe
2
3# This script will be run by OpenStack CI before unit tests are run,
4# it sets up the test system as needed.
5# Developers should setup their test systems in a similar way.
6
7# This setup needs to be run as a user that can run sudo.
8
Paul Belanger6a766dc2017-03-22 08:53:41 -04009# Be sure mysql and zookeeper are started.
10sudo service mysql start
11sudo service zookeeper start
12
Joshua Heskethd78b4482015-09-14 16:56:34 -060013# The root password for the MySQL database; pass it in via
14# MYSQL_ROOT_PW.
15DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave}
16
17# This user and its password are used by the tests, if you change it,
18# your tests might fail.
19DB_USER=openstack_citest
20DB_PW=openstack_citest
21
22sudo -H mysqladmin -u root password $DB_ROOT_PW
23
24# It's best practice to remove anonymous users from the database. If
25# a anonymous user exists, then it matches first for connections and
26# other connections from that host will not work.
27sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e "
28 DELETE FROM mysql.user WHERE User='';
29 FLUSH PRIVILEGES;
30 GRANT ALL PRIVILEGES ON *.*
31 TO '$DB_USER'@'%' identified by '$DB_PW' WITH GRANT OPTION;"
32
33# Now create our database.
34mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e "
35 SET default_storage_engine=MYISAM;
36 DROP DATABASE IF EXISTS openstack_citest;
37 CREATE DATABASE openstack_citest CHARACTER SET utf8;"
Paul Belanger29896722017-05-02 12:47:49 -040038
39# TODO(pabelanger): Move this into bindep after we figure out how to enable our
40# PPA.
41sudo add-apt-repository ppa:openstack-ci-core/bubblewrap
42sudo apt-get update
43sudo apt-get --assume-yes install bubblewrap