Debian Codegraph @

debian/tests/setup

raw
1 #!/bin/bash
2 # based off of https://salsa.debian.org/perl-team/modules/packages/libdbd-mariadb-perl/-/blob/3f83abd55844ec22ba9b6d8f5a2a3ebdcd0ec3b6/debian/tests/pkg-perl/smoke-setup
3 # and https://github.com/mariadb-corporation/connector-test-machine/blob/d0ac910e69cab92e3d485d4e3709acf358e766d2/launch.sh#L82
4 set -ex
5
6 /usr/bin/mariadb-install-db --no-defaults --datadir=${MARIADB_DIR} --force --skip-name-resolve --explicit_defaults_for_timestamp 2>&1
7
8 /usr/sbin/mysqld --no-defaults --user=${MARIADB_USER} --socket=${MARIADB_UNIX_PORT} -P10010 --datadir=${MARIADB_DIR} --pid-file=${MARIADB_PIDFILE} --explicit_defaults_for_timestamp 2>&1 &
9
10 attempts=0
11 while ! /usr/bin/mariadb-admin --user=${MARIADB_USER} --socket=${MARIADB_UNIX_PORT} ping 2>&1 ; do
12 sleep 3
13 attempts=$((attempts+1))
14 if [ ${attempts} -gt 10 ] ; then
15 echo "skipping test, the mariadb server could not be contacted after 30 seconds"
16 exit 1
17 fi
18 done
19
20 /usr/bin/mariadb --user=${MARIADB_USER} --socket=${MARIADB_UNIX_PORT} -e "create DATABASE IF NOT EXISTS ${TEST_DB_DATABASE}"
21
22 /usr/bin/mariadb --user=${MARIADB_USER} --socket=${MARIADB_UNIX_PORT} ${TEST_DB_DATABSE} <<EOT
23 CREATE USER IF NOT EXISTS '${TEST_DB_USERNAME}'@'%' identified by '${TEST_DB_PASSWORD}';
24 GRANT ALL ON *.* TO '${TEST_DB_USERNAME}'@'%' /*M!100401 identified by 'heyPassword'*/ with grant option;
25
26 CREATE USER IF NOT EXISTS '${TEST_DB_USERNAME}'@'localhost' identified by '${TEST_DB_PASSWORD}';
27 GRANT ALL ON *.* TO '${TEST_DB_USERNAME}'@'localhost' /*M!100401 identified by 'heyPassword'*/ with grant option;
28 EOT