forked from Nitrate/Nitrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Nitrate#1188 from tkdchen/fix-testenv-docker
ci: fix tests with real databases
- Loading branch information
Showing
6 changed files
with
107 additions
and
67 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
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
set -ex | ||
|
||
username=$1 | ||
password=$2 | ||
tempfile=$(mktemp) | ||
|
||
# Guess container name of the test database | ||
if ! docker ps -a --format "{{ json .Names }}" | tr -d '"' | grep "^testdb_mysql" >"$tempfile" 2>&1; then | ||
echo "error: cannot find container testdb_mysql" | ||
exit 1 | ||
CONTAINER_NAME=testdb-mysql | ||
|
||
if ! docker inspect "$CONTAINER_NAME" >/dev/null 2>&1; then | ||
echo "error: cannot find container $CONTAINER_NAME" >&2 | ||
exit 1 | ||
fi | ||
c_name=$(cat "$tempfile") | ||
|
||
docker exec "$c_name" /bin/bash -c " | ||
mysql -u${username} -p${password} \ | ||
-e \"ALTER USER '${username}'@'%' IDENTIFIED WITH mysql_native_password BY '${password}'\" | ||
" | ||
ALTER_USER_CMD="ALTER USER '${username}'@'%' IDENTIFIED WITH mysql_native_password BY '${password}'" | ||
docker exec "$CONTAINER_NAME" /bin/bash -c "mysql -u${username} -p${password} -e \"${ALTER_USER_CMD}\"" |
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
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