-
Notifications
You must be signed in to change notification settings - Fork 511
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 #824 from cyli/db-tests-refactor
Set rethink and mysql server DB storage tests to run on circle
- Loading branch information
Showing
20 changed files
with
1,063 additions
and
616 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
db="$1" | ||
|
||
case ${db} in | ||
mysql*) | ||
db="mysql" | ||
dbContainerOpts="--name mysql_tests mysql mysqld --innodb_file_per_table" | ||
DBURL="server@tcp(mysql_tests:3306)/notaryserver?parseTime=True" | ||
;; | ||
rethink*) | ||
db="rethink" | ||
dbContainerOpts="--name rethinkdb_tests rdb-01 --bind all --driver-tls-key /tls/key.pem --driver-tls-cert /tls/cert.pem" | ||
DBURL="rethinkdb_tests" | ||
;; | ||
*) | ||
echo "Usage: $0 (mysql|rethink)" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
composeFile="development.${db}.yml" | ||
project=dbtests | ||
|
||
function cleanup { | ||
rm -f bin/notary | ||
docker-compose -p "${project}_${db}" -f "${composeFile}" kill | ||
# if we're in CircleCI, we cannot remove any containers | ||
if [[ -z "${CIRCLECI}" ]]; then | ||
docker-compose -p "${project}_${db}" -f "${composeFile}" down -v --remove-orphans | ||
fi | ||
} | ||
|
||
clientCmd="make test" | ||
if [[ -z "${CIRCLECI}" ]]; then | ||
BUILDOPTS="--force-rm" | ||
else | ||
clientCmd="make ci && codecov" | ||
fi | ||
|
||
set -e | ||
set -x | ||
|
||
cleanup | ||
|
||
docker-compose -p "${project}_${db}" -f ${composeFile} build ${BUILDOPTS} client | ||
|
||
trap cleanup SIGINT SIGTERM EXIT | ||
|
||
# run the unit tests that require a DB | ||
|
||
docker-compose -p "${project}_${db}" -f "${composeFile}" run --no-deps -d ${dbContainerOpts} | ||
docker-compose -p "${project}_${db}" -f "${composeFile}" run --no-deps \ | ||
-e NOTARY_BUILDTAGS="${db}db" -e DBURL="${DBURL}" \ | ||
-e PKGS="github.com/docker/notary/server/storage" \ | ||
client bash -c "${clientCmd}" |
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 |
---|---|---|
|
@@ -38,3 +38,5 @@ WORKSPACE | |
# TRAVIS_REPO_SLUG | ||
# TRAVIS_COMMIT | ||
# TRAVIS_BUILD_DIR | ||
|
||
SKIPENVCHECK=1 |
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
Oops, something went wrong.