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
Explicitly specify the name of the container running tests in Jenkins #316
Conversation
@brainzbot retest this please |
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.
Looks good, but I think we just need --name
in one place.
docker/jenkins-test.sh
Outdated
@@ -46,14 +46,14 @@ function run_tests { | |||
|
|||
# create database and user once | |||
echo "creating user and database" | |||
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run --rm $TEST_CONTAINER_NAME \ | |||
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run --rm $TEST_CONTAINER_NAME --name $TEST_CONTAINER_REF\ |
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.
I don't think we need --name
here - we're already using --rm
. This container only runs init_db and then quits and removes itself.
docker/jenkins-test.sh
Outdated
dockerize \ | ||
-wait tcp://db:5432 -timeout 60s bash -c \ | ||
"cd /code && cp config.py.example config.py && ls -lR && python manage.py init_db" | ||
|
||
# run tests | ||
echo "running tests" | ||
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run $TEST_CONTAINER_NAME \ | ||
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run $TEST_CONTAINER_NAME --name $TEST_CONTAINER_REF \ |
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.
Should we add a comment saying why we explicitly set a name? (so that we have a consistent name so that we can use docker cp
later in the script)
The only thing we have to be sure about here is that the containers gets removed properly after it runs, and that different runs of the tests don't conflict with each other. I think that we're OK here:
- the project name contains the jenkins tag, which increases for each time that jenkins runs a job (and this is always how it's run in the past, without problems)
- the cleanup function stops and removes all containers with the project name, so this should be removed as well with no problems
No description provided.