Skip to content

Commit 9311f54

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "tests: Allow bindep and test-setup.sh to run on EL distros"
2 parents 6b72763 + 085de86 commit 9311f54

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

bindep.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ libxml2-dev [platform:dpkg test]
2424
libxslt-devel [platform:rpm test]
2525
libxslt1-dev [platform:dpkg test]
2626
locales [platform:debian]
27-
mysql [platform:rpm]
27+
mysql [platform:rpm !platform:redhat]
2828
mysql-client [platform:dpkg]
29-
mysql-devel [platform:rpm test]
30-
mysql-server
29+
mysql-devel [platform:rpm !platform:redhat test]
30+
mysql-server [!platform:redhat]
31+
mariadb-devel [platform:rpm platform:redhat test]
32+
mariadb-server [platform:rpm platform:redhat]
3133
openssh-client [platform:dpkg]
3234
openssh-clients [platform:rpm]
3335
openssl

tools/test-setup.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@ DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave}
1515
DB_USER=openstack_citest
1616
DB_PW=openstack_citest
1717

18+
function is_rhel7 {
19+
[ -f /usr/bin/yum ] && \
20+
cat /etc/*release | grep -q -e "Red Hat" -e "CentOS" -e "CloudLinux" && \
21+
cat /etc/*release | grep -q 'release 7'
22+
}
23+
24+
function is_rhel8 {
25+
[ -f /usr/bin/dnf ] && \
26+
cat /etc/*release | grep -q -e "Red Hat" -e "CentOS" -e "CloudLinux" && \
27+
cat /etc/*release | grep -q 'release 8'
28+
}
29+
30+
function set_conf_line { # file regex value
31+
sudo sh -c "grep -q -e '$2' $1 && \
32+
sed -i 's|$2|$3|g' $1 || \
33+
echo '$3' >> $1"
34+
}
35+
36+
if is_rhel7 || is_rhel8; then
37+
# mysql needs to be started on centos/rhel
38+
sudo systemctl restart mariadb.service
39+
40+
# postgres setup for centos
41+
sudo postgresql-setup --initdb
42+
PG_CONF=/var/lib/pgsql/data/postgresql.conf
43+
set_conf_line $PG_CONF '^password_encryption =.*' 'password_encryption = scram-sha-256'
44+
45+
PG_HBA=/var/lib/pgsql/data/pg_hba.conf
46+
set_conf_line $PG_HBA '^local[ \t]*all[ \t]*all.*' 'local all all peer'
47+
set_conf_line $PG_HBA '^host[ \t]*all[ \t]*all[ \t]*127.0.0.1\/32.*' 'host all all 127.0.0.1/32 scram-sha-256'
48+
set_conf_line $PG_HBA '^host[ \t]*all[ \t]*all[ \t]*::1\/128.*' 'host all all ::1/128 scram-sha-256'
49+
50+
sudo systemctl restart postgresql.service
51+
fi
52+
1853
sudo -H mysqladmin -u root password $DB_ROOT_PW
1954

2055
# It's best practice to remove anonymous users from the database. If

0 commit comments

Comments
 (0)