Refactor installation of specific WP version in test env

This commit changes how we install a specific WP version when required
for tests via the WORDPRESS_VERSION env variable.
In the previous approach, we installed the original version from the image
and then updated to the required version. We had some issues as after the
update, there might be some leftover background tasks, etc. that may
interfere with the tests.
In the new approach, we download the required version
prior to the installation.
[MAILPOET-6501]
This commit is contained in:
Rostislav Wolny
2025-03-12 14:56:22 +01:00
committed by Jan Lysý
parent 4b4ed2814c
commit f59b98eb88

View File

@@ -36,6 +36,12 @@ wp config set WP_AUTO_UPDATE_CORE false --raw
mysqladmin --host=mysql --user=root --password=wordpress drop wordpress --force mysqladmin --host=mysql --user=root --password=wordpress drop wordpress --force
mysqladmin --host=mysql --user=root --password=wordpress create wordpress --force mysqladmin --host=mysql --user=root --password=wordpress create wordpress --force
if [[ $WORDPRESS_VERSION != "" ]]; then
echo "Downloading WordPress version: $WORDPRESS_VERSION"
wp core download --version=$WORDPRESS_VERSION --force
fi
# install WordPress # install WordPress
WP_CORE_INSTALL_PARAMS="--url=$HTTP_HOST --title=tests --admin_user=admin --admin_email=test@test.com --admin_password=password --skip-email" WP_CORE_INSTALL_PARAMS="--url=$HTTP_HOST --title=tests --admin_user=admin --admin_email=test@test.com --admin_password=password --skip-email"
if [[ -z "$MULTISITE" || "$MULTISITE" -eq "0" ]]; then if [[ -z "$MULTISITE" || "$MULTISITE" -eq "0" ]]; then
@@ -47,11 +53,6 @@ else
wp site create --slug=$WP_TEST_MULTISITE_SLUG wp site create --slug=$WP_TEST_MULTISITE_SLUG
fi fi
if [[ $WORDPRESS_VERSION != "" ]]; then
echo "Installing WordPress version: $WORDPRESS_VERSION"
wp core update --version=$WORDPRESS_VERSION
wp core update-db
fi
echo "WORDPRESS VERSION:" echo "WORDPRESS VERSION:"
wp core version wp core version