Merge pull request #14093 from mexon/mat/autotest-password

allow overriding password during local testing
pull/14095/head
Hypolite Petovan 2024-04-14 21:54:59 -04:00 committed by GitHub
commit 9329eebec0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 10 deletions

View File

@ -138,9 +138,9 @@ function execute_tests() {
if [ -n "${USEDOCKER}" ]; then if [ -n "${USEDOCKER}" ]; then
echo "Fire up the mysql docker" echo "Fire up the mysql docker"
DOCKER_CONTAINER_ID=$(docker run \ DOCKER_CONTAINER_ID=$(docker run \
-e MYSQL_ROOT_PASSWORD=friendica \ -e MYSQL_ROOT_PASSWORD="${DATABASE_PASSWORD}" \
-e MYSQL_USER="${DATABASE_USER}" \ -e MYSQL_USER="${DATABASE_USER}" \
-e MYSQL_PASSWORD=friendica \ -e MYSQL_PASSWORD="${DATABASE_PASSWORD}" \
-e MYSQL_DATABASE="${DATABASE_NAME}" \ -e MYSQL_DATABASE="${DATABASE_NAME}" \
-d mysql) -d mysql)
DATABASE_HOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${DOCKER_CONTAINER_ID}") DATABASE_HOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${DOCKER_CONTAINER_ID}")
@ -152,8 +152,8 @@ function execute_tests() {
echo "To use the docker container set the USEDOCKER environment variable" echo "To use the docker container set the USEDOCKER environment variable"
exit 3 exit 3
fi fi
mysql -u "${DATABASE_USER}" -pfriendica -e "DROP DATABASE IF EXISTS ${DATABASE_NAME}" -h ${DATABASE_HOST} || true mysql -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" -e "DROP DATABASE IF EXISTS ${DATABASE_NAME}" -h ${DATABASE_HOST} || true
mysql -u "${DATABASE_USER}" -pfriendica -e "CREATE DATABASE ${DATABASE_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" -h ${DATABASE_HOST} mysql -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" -e "CREATE DATABASE ${DATABASE_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" -h ${DATABASE_HOST}
else else
DATABASE_HOST=mysql DATABASE_HOST=mysql
fi fi
@ -171,9 +171,9 @@ function execute_tests() {
if [ -n "${USEDOCKER}" ]; then if [ -n "${USEDOCKER}" ]; then
echo "Fire up the mariadb docker" echo "Fire up the mariadb docker"
DOCKER_CONTAINER_ID=$(docker run \ DOCKER_CONTAINER_ID=$(docker run \
-e MYSQL_ROOT_PASSWORD=friendica \ -e MYSQL_ROOT_PASSWORD="${DATABASE_PASSWORD}" \
-e MYSQL_USER="${DATABASE_USER}" \ -e MYSQL_USER="${DATABASE_USER}" \
-e MYSQL_PASSWORD=friendica \ -e MYSQL_PASSWORD="${DATABASE_PASSWORD}" \
-e MYSQL_DATABASE="${DATABASE_NAME}" \ -e MYSQL_DATABASE="${DATABASE_NAME}" \
-d mariadb) -d mariadb)
DATABASE_HOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${DOCKER_CONTAINER_ID}") DATABASE_HOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "${DOCKER_CONTAINER_ID}")
@ -185,8 +185,8 @@ function execute_tests() {
echo "To use the docker container set the USEDOCKER environment variable" echo "To use the docker container set the USEDOCKER environment variable"
exit 3 exit 3
fi fi
mysql -u "${DATABASE_USER}" -pfriendica -e "DROP DATABASE IF EXISTS ${DATABASE_NAME}" -h ${DATABASE_HOST} || true mysql -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" -e "DROP DATABASE IF EXISTS ${DATABASE_NAME}" -h ${DATABASE_HOST} || true
mysql -u "${DATABASE_USER}" -pfriendica -e "CREATE DATABASE ${DATABASE_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" -h ${DATABASE_HOST} mysql -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" -e "CREATE DATABASE ${DATABASE_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" -h ${DATABASE_HOST}
else else
DATABASE_HOST=mariadb DATABASE_HOST=mariadb
fi fi
@ -203,14 +203,14 @@ function execute_tests() {
if [ -n "${USEDOCKER}" ]; then if [ -n "${USEDOCKER}" ]; then
echo "Initialize database..." echo "Initialize database..."
docker exec ${DOCKER_CONTAINER_ID} mysql -u root -pfriendica -e "CREATE DATABASE IF NOT EXISTS ${DATABASE_NAME};" docker exec ${DOCKER_CONTAINER_ID} mysql -u root -p"${DATABASE_PASSWORD}" -e "CREATE DATABASE IF NOT EXISTS ${DATABASE_NAME};"
fi fi
export MYSQL_HOST="${DATABASE_HOST}" export MYSQL_HOST="${DATABASE_HOST}"
#call installer #call installer
echo "Installing Friendica..." echo "Installing Friendica..."
"${PHP}" ./bin/console.php autoinstall --dbuser="${DATABASE_USER}" --dbpass=friendica --dbdata="${DATABASE_NAME}" --dbhost="${DATABASE_HOST}" --url=https://friendica.local --admin=admin@friendica.local "${PHP}" ./bin/console.php autoinstall --dbuser="${DATABASE_USER}" --dbpass="${DATABASE_PASSWORD}" --dbdata="${DATABASE_NAME}" --dbhost="${DATABASE_HOST}" --url=https://friendica.local --admin=admin@friendica.local
fi fi
#test execution #test execution