8000 travis: faster DB startup wait by methane · Pull Request #773 · PyMySQL/PyMySQL · GitHub
[go: up one dir, main page]

Skip to content

travis: faster DB startup wait #773

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

Merged
merged 1 commit into from
Jan 17, 2019
Merged
Changes from all 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
96 changes: 40 additions & 56 deletions .travis/initializedb.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,46 @@
#!/bin/bash

#error,debug,verbose,
set -exv

if [ ! -z "${DB}" ]; then
docker pull ${DB}
docker run -it --name=mysqld -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}
sleep 15

mysql() {
docker exec mysqld mysql "${@}"
}
while :
do
sleep 5
mysql -e 'select version()' && break
echo "server logs"
docker logs --tail 5 mysqld
done

if [ $DB == 'mysql:8.0' ]; then
WITH_PLUGIN='with mysql_native_password'
mysql -e 'SET GLOBAL local_infile=on'
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"

# Test user for auth test
mysql -e '
CREATE USER
user_sha256 IDENTIFIED WITH "sha256_password" BY "pass_sha256",
nopass_sha256 IDENTIFIED WITH "sha256_password",
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2",
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
PASSWORD EXPIRE NEVER;'
mysql -e 'GRANT RELOAD ON *.* TO user_caching_sha2;'
else
WITH_PLUGIN=''
fi

mysql -uroot -e 'create database test1 DEFAULT CHARACTER SET utf8mb4'
mysql -uroot -e 'create database test2 DEFAULT CHARACTER SET utf8mb4'

mysql -u root -e "create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
mysql -u root -e "create user test2@localhost identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2@localhost;"

cp .travis/docker.json pymysql/tests/databases.json
set -ex

docker pull ${DB}
docker run -it --name=mysqld -d -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 ${DB}

mysql() {
docker exec mysqld mysql "${@}"
}
while :
do
sleep 3
mysql --protocol=tcp -e 'select version()' && break
done
docker logs mysqld

if [ $DB == 'mysql:8.0' ]; then
WITH_PLUGIN='with mysql_native_password'
mysql -e 'SET GLOBAL local_infile=on'
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"

# Test user for auth test
mysql -e '
CREATE USER
user_sha256 IDENTIFIED WITH "sha256_password" BY "pass_sha256",
nopass_sha256 IDENTIFIED WITH "sha256_password",
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2",
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
PASSWORD EXPIRE NEVER;'
mysql -e 'GRANT RELOAD ON *.* TO user_caching_sha2;'
else
cat ~/.my.cnf
WITH_PLUGIN=''
fi

mysql -e 'select VERSION()'
mysql -e 'create database test1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
mysql -e 'create database test2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
mysql -uroot -e 'create database test1 DEFAULT CHARACTER SET utf8mb4'
mysql -uroot -e 'create database test2 DEFAULT CHARACTER SET utf8mb4'

mysql -u root -e "create user test2 identified by 'some password'; grant all on test2.* to test2;"
mysql -u root -e "create user test2@localhost identified by 'some password'; grant all on test2.* to test2@localhost;"
mysql -u root -e "create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
mysql -u root -e "create user test2@localhost identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2@localhost;"

cp .travis/database.json pymysql/tests/databases.json
fi
cp .travis/docker.json pymysql/tests/databases.json
0