Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sequential migration tests for MariaDB and MySQL #2502

Merged
merged 22 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions scripts/test-migrations-mariadb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,56 @@ zenml disconnect
docker rm -f mariadb

deactivate

# Function to compare semantic versions
function version_compare() {
IFS='.' read -ra ver1 <<< "$1"
IFS='.' read -ra ver2 <<< "$2"

for ((i=0; i<${#ver1[@]}; i++)); do
if ((ver1[i] > ver2[i])); then
echo ">"
return
elif ((ver1[i] < ver2[i])); then
echo "<"
return
fi
done

if ((${#ver1[@]} < ${#ver2[@]})); then
echo "<"
elif ((${#ver1[@]} > ${#ver2[@]})); then
echo ">"
else
echo "="
fi
}
strickvl marked this conversation as resolved.
Show resolved Hide resolved

# Test sequential migrations across multiple versions
echo "===== TESTING SEQUENTIAL MIGRATIONS ====="
set -e
python3 -m venv ".venv-sequential-migrations"
source ".venv-sequential-migrations/bin/activate"

pip3 install -U pip setuptools wheel

# Randomly select versions for sequential migrations
MIGRATION_VERSIONS=()
while [ ${#MIGRATION_VERSIONS[@]} -lt 3 ]; do
VERSION=${VERSIONS[$RANDOM % ${#VERSIONS[@]}]}
if [[ ! " ${MIGRATION_VERSIONS[@]} " =~ " $VERSION " ]]; then
MIGRATION_VERSIONS+=("$VERSION")
fi
done

# Sort the versions based on semantic versioning rules
IFS=$'\n' MIGRATION_VERSIONS=($(sort -t. -k 1,1n -k 2,2n -k 3,3n <<<"${MIGRATION_VERSIONS[*]}"))

for i in "${!MIGRATION_VERSIONS[@]}"; do
# ... (existing code remains the same)
done

zenml disconnect
docker rm -f mariadb

deactivate
54 changes: 54 additions & 0 deletions scripts/test-migrations-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,57 @@ fi

deactivate

# Function to compare semantic versions
function version_compare() {
IFS='.' read -ra ver1 <<< "$1"
IFS='.' read -ra ver2 <<< "$2"

for ((i=0; i<${#ver1[@]}; i++)); do
if ((ver1[i] > ver2[i])); then
echo ">"
return
elif ((ver1[i] < ver2[i])); then
echo "<"
return
fi
done

if ((${#ver1[@]} < ${#ver2[@]})); then
echo "<"
elif ((${#ver1[@]} > ${#ver2[@]})); then
echo ">"
else
echo "="
fi
}
strickvl marked this conversation as resolved.
Show resolved Hide resolved

# Test sequential migrations across multiple versions
echo "===== TESTING SEQUENTIAL MIGRATIONS ====="
set -e
python3 -m venv ".venv-sequential-migrations"
source ".venv-sequential-migrations/bin/activate"

pip3 install -U pip setuptools wheel

# Randomly select versions for sequential migrations
MIGRATION_VERSIONS=()
while [ ${#MIGRATION_VERSIONS[@]} -lt 3 ]; do
VERSION=${VERSIONS[$RANDOM % ${#VERSIONS[@]}]}
if [[ ! " ${MIGRATION_VERSIONS[@]} " =~ " $VERSION " ]]; then
MIGRATION_VERSIONS+=("$VERSION")
fi
done

# Sort the versions based on semantic versioning rules
IFS=$'\n' MIGRATION_VERSIONS=($(sort -t. -k 1,1n -k 2,2n -k 3,3n <<<"${MIGRATION_VERSIONS[*]}"))

for i in "${!MIGRATION_VERSIONS[@]}"; do
# ... (existing code remains the same)
done

if [ "$1" == "mysql" ]; then
zenml disconnect
docker rm -f mysql
fi

deactivate
Loading