-
Notifications
You must be signed in to change notification settings - Fork 511
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
Set rethink and mysql server DB storage tests to run on circle #824
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ddb2860
Rename server and signer storage items to reflect the db type
cyli 4f43dab
Split SQL DB creation into a separate file so we can test against a r…
cyli 5feac09
Set up mysql server tests to run on circle
cyli c61be06
Enable tests that require a rethink connection too, and add a bootstr…
cyli e5c4e6b
Refactor some of the TUF metadata storage tests to be more general, s…
cyli b76b1cb
Fix lint issue, and reconfigure build scripts so db test and integrat…
cyli 2341a2a
Fix comment and combine linting make targets into a single one.
cyli 1eb6094
Fix a somewhat buggy testUpdateManyNoConflicts (as metadata is update…
cyli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking nit: would be nice to have a default error case in case someone tries to run this one-off, something like:
Currently I get the following if I don't provide any arg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added