Skip to content

Commit

Permalink
Provide a preconfigured docker command to run tests (DataDog#655)
Browse files Browse the repository at this point in the history
* [tests] Provide a CLI preconfogure docker command to run tests

* [tests] Base the test runner on a docker compose service

* [tests] Fixed typo in read me
  • Loading branch information
labbati authored Oct 18, 2018
1 parent 1c5a3ba commit eb70520
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ launch them through:
[docker-compose]: https://www.docker.com/products/docker-compose


#### Running the Tests
#### Running the Tests in your local environment

Once docker is up and running you should be able to run the tests. To launch a
single test manually. For example to run the tests for `redis-py` 2.10 on Python
Expand All @@ -61,6 +61,33 @@ To launch the complete test matrix run:
$ tox


#### Running Tests in docker

If you prefer not to setup your local machine to run tests, we provide a preconfigured docker image.
Note that this image is the same used in CircleCI to run tests.

You still need docker containers running additional services up and running.

Run the test runner

$ docker-compose run --rm testrunner

Now you are in a bash shell. You can now run tests as you would do in your local environment:

$ tox -e '{py35,py36}-redis{210}'

If you are in a unix machine, we also provide a shell script to execute commands in the provided container (so you don't
forget to remove-`--rm` the container after you run it).

For example to run the tests for `redis-py` 2.10 on Python 3.5 and 3.6:

$ ./scripts/ddtest tox -e '{py35,py36}-redis{210}'

You can also add the `scripts` folder to your path, so then you can run

$ ddtest tox -e '{py35,py36}-redis{210}'


### Continuous Integration

We use CircleCI 2.0 for our continuous integration.
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,18 @@ services:
- VP_TEST_DATABASE=docker
ports:
- "127.0.0.1:5433:5433"

testrunner:
image: datadog/docker-library:ddtrace_py
environment:
- TOX_SKIP_DIST=True
network_mode: host
working_dir: /src
volumes:
- ./ddtrace:/src/ddtrace:ro
- ./tests:/src/tests:ro
- ./setup.cfg:/src/setup.cfg:ro
- ./setup.py:/src/setup.py:ro
- ./tox.ini:/src/tox.ini:ro
- ./.ddtox:/src/.tox
command: bash
5 changes: 5 additions & 0 deletions scripts/ddtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

docker-compose run --rm testrunner $*

0 comments on commit eb70520

Please sign in to comment.