-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MariaDB migration testing (#2170)
* update script to handle mariadb migration testing * WIP * reformat temporary script * parameterize DB startup delay * add a check for mysql vs mariadb * try another way to isolate mariadb vs mysql * try a different mariadb connection path * Fix database connection URL in test-migrations.sh script * Adjust settings for MySQL and MariaDB engines in migration script * log values * temporarily disable full CI runs for testing * print values * trying a different connection approach * trying innodb * Add support for MariaDB in primary key modification * split mariadb from mysql db migration testing * split mariadb from mysql db migration testing (core) * Remove support for MariaDB and add version 0.53.1 * Split out mariadb from mysql in migration testing * add latest zenml version * Update migration testing scripts for different databases * restore the CI to working state * formatting * use zenml init * reformat yml * revert to copier instantiation * add conditional check for version >= 0.43.0 * compare set of vals instead of complicated semantic check * remove extra cd * update mariadb script * add test flag to init command * remove (extra) analytics opt-out * Add additional template versions for testing migrations * enable the CI again * Add comment explaining pre-template-versions
- Loading branch information
Showing
3 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
DB="mariadb" | ||
DB_STARTUP_DELAY=30 # Time in seconds to wait for the database container to start | ||
|
||
function run_tests_for_version() { | ||
set -e # Exit immediately if a command exits with a non-zero status | ||
local VERSION=$1 | ||
|
||
echo "===== Testing version $VERSION =====" | ||
|
||
mkdir test_starter | ||
zenml init --template starter --path test_starter --template-with-defaults --test | ||
cd test_starter | ||
|
||
export ZENML_ANALYTICS_OPT_IN=false | ||
export ZENML_DEBUG=true | ||
|
||
echo "===== Installing sklearn integration =====" | ||
zenml integration install sklearn -y | ||
|
||
echo "===== Running starter template pipeline =====" | ||
python3 run.py | ||
# Add additional CLI tests here | ||
zenml version | ||
|
||
# Confirm DB works and is accessible | ||
zenml pipeline runs list | ||
|
||
cd .. | ||
rm -rf test_starter | ||
echo "===== Finished testing version $VERSION =====" | ||
} | ||
|
||
echo "===== Testing MariaDB =====" | ||
# run a mariadb instance in docker | ||
docker run --name mariadb -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mariadb:10.6 | ||
# mariadb takes a while to start up | ||
sleep $DB_STARTUP_DELAY | ||
|
||
# List of versions to test | ||
VERSIONS=("0.54.0") | ||
|
||
# Start completely fresh | ||
rm -rf ~/.config/zenml | ||
|
||
for VERSION in "${VERSIONS[@]}" | ||
do | ||
set -e # Exit immediately if a command exits with a non-zero status | ||
# Create a new virtual environment | ||
python3 -m venv ".venv-$VERSION" | ||
source ".venv-$VERSION/bin/activate" | ||
|
||
# Install the specific version | ||
pip3 install -U pip setuptools wheel | ||
pip3 install "zenml[templates,server]==$VERSION" | ||
|
||
zenml connect --url mysql://127.0.0.1/zenml --username root --password password | ||
|
||
# Run the tests for this version | ||
run_tests_for_version $VERSION | ||
|
||
zenml disconnect | ||
sleep 5 | ||
|
||
deactivate | ||
done | ||
|
||
# Test the most recent migration with MariaDB | ||
echo "===== TESTING CURRENT BRANCH =====" | ||
set -e | ||
python3 -m venv ".venv-current-branch" | ||
source ".venv-current-branch/bin/activate" | ||
|
||
pip3 install -U pip setuptools wheel | ||
pip3 install -e ".[templates,server]" | ||
pip3 install importlib_metadata | ||
|
||
zenml connect --url mysql://127.0.0.1/zenml --username root --password password | ||
|
||
run_tests_for_version current_branch_mariadb | ||
|
||
zenml disconnect | ||
docker rm -f mariadb | ||
|
||
deactivate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters