-
Notifications
You must be signed in to change notification settings - Fork 19
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 #147 from /issues/125
Issues/125
- Loading branch information
Showing
4 changed files
with
100 additions
and
44 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
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 |
---|---|---|
|
@@ -85,6 +85,44 @@ If you want to run the acceptance tests without dumping and refreshing the test | |
environment variable will prevent refreshing the DB after classes that manipulate data; | ||
this will cause subsequent tests to fail but can be useful for debugging. | ||
|
||
Running Acceptance Tests Against Docker | ||
+++++++++++++++++++++++++++++++++++++++ | ||
|
||
The acceptance tests have a "hidden" hook to run against an already-running Flask application, | ||
such as testing the Docker containers. **Be warned** that the acceptance tests modify data, | ||
so they should never be run against a real database. This hook is controlled via the | ||
``BIWEEKLYBUDGET_TEST_BASE_URL`` environment variable. If this variable is set, the acceptance | ||
tests will not start a Flask server, but will instead use the specified URL. The URL must not | ||
end with a trailing slash. | ||
|
||
An example of testing a recently-built Docker container is below: | ||
|
||
```bash | ||
tox -e docker | ||
# lots of output; ending with something like: Image "<DOCKER_TAG>" built and tested. | ||
# get a timestamp to use in the container names | ||
TS=$(date +%s) | ||
# run mysql container | ||
docker run -d --name biweeklybudget-mariadb-${TS} -e MYSQL_ROOT_PASSWORD=root -p 3306 mariadb:5.5.56 | ||
# wait a few seconds for the DB to start up. If this next command fails, wait a bit and try again | ||
docker exec -it biweeklybudget-mariadb-${TS} /usr/bin/mysql -uroot -proot -e "CREATE DATABASE budgetfoo;" | ||
# Find the port number (<DockerPort>) that the MySQL container is bound to on the host | ||
export DB_CONNSTRING='mysql+pymysql://root:[email protected]:<DockerPort>/budgetfoo?charset=utf8mb4' | ||
# run docker container | ||
docker run -d --name biweeklybudget-test-${TS} -e DB_CONNSTRING='mysql+pymysql://root:root@mysql:3306/budgetfoo?charset=utf8mb4' --link biweeklybudget-mariadb-${TS}:mysql -p 80 jantman/biweeklybudget:<DOCKER_TAG> | ||
docker ps | ||
# in the docker ps output, find the host port (<DockerPort>) that is bound to port 80 on the biweeklybudget container | ||
export BIWEEKLYBUDGET_TEST_BASE_URL=http://127.0.0.1:<DockerPort> | ||
# if you want, run `docker logs -f biweeklybudget-test-${TS}` in another shell | ||
tox -e acceptance36 | ||
# when the tests finish: | ||
docker stop biweeklybudget-test-${TS} biweeklybudget-mariadb-${TS} | ||
docker rm biweeklybudget-test-${TS} biweeklybudget-mariadb-${TS} | ||
``` | ||
|
||
To ensure that the tests are running against the appropriate container, you may want | ||
to watch the Docker container's logs during the test run. | ||
|
||
.. _development.alembic: | ||
|
||
Alembic DB Migrations | ||
|
@@ -150,7 +188,8 @@ Release Checklist | |
2. Verify whether or not DB migrations are needed. If they are, ensure they've been created, tested and verified. | ||
3. Confirm that there are CHANGES.rst entries for all major changes. | ||
4. Rebuild documentation and javascript documentation locally: ``tox -e jsdoc,docs``. Commit any changes. | ||
5. Run the Docker image build and tests locally: ``tox -e docker``. | ||
5. Run the Docker image build and tests locally: ``tox -e docker``. If the pull request includes changes to the Dockerfile | ||
or the container build process, run acceptance tests against the newly-built container as described above. | ||
6. Ensure that Travis tests passing in all environments. | ||
7. Ensure that test coverage is no less than the last release, and that there are acceptance tests for any non-trivial changes. | ||
8. If there have been any major visual or functional changes to the UI, regenerate screenshots via ``tox -e screenshots``. | ||
|