Skip to content

Commit eb70520

Browse files
authored
Provide a preconfigured docker command to run tests (#655)
* [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
1 parent 1c5a3ba commit eb70520

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ launch them through:
4646
[docker-compose]: https://www.docker.com/products/docker-compose
4747

4848

49-
#### Running the Tests
49+
#### Running the Tests in your local environment
5050

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

6363

64+
#### Running Tests in docker
65+
66+
If you prefer not to setup your local machine to run tests, we provide a preconfigured docker image.
67+
Note that this image is the same used in CircleCI to run tests.
68+
69+
You still need docker containers running additional services up and running.
70+
71+
Run the test runner
72+
73+
$ docker-compose run --rm testrunner
74+
75+
Now you are in a bash shell. You can now run tests as you would do in your local environment:
76+
77+
$ tox -e '{py35,py36}-redis{210}'
78+
79+
If you are in a unix machine, we also provide a shell script to execute commands in the provided container (so you don't
80+
forget to remove-`--rm` the container after you run it).
81+
82+
For example to run the tests for `redis-py` 2.10 on Python 3.5 and 3.6:
83+
84+
$ ./scripts/ddtest tox -e '{py35,py36}-redis{210}'
85+
86+
You can also add the `scripts` folder to your path, so then you can run
87+
88+
$ ddtest tox -e '{py35,py36}-redis{210}'
89+
90+
6491
### Continuous Integration
6592

6693
We use CircleCI 2.0 for our continuous integration.

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,18 @@ services:
7878
- VP_TEST_DATABASE=docker
7979
ports:
8080
- "127.0.0.1:5433:5433"
81+
82+
testrunner:
83+
image: datadog/docker-library:ddtrace_py
84+
environment:
85+
- TOX_SKIP_DIST=True
86+
network_mode: host
87+
working_dir: /src
88+
volumes:
89+
- ./ddtrace:/src/ddtrace:ro
90+
- ./tests:/src/tests:ro
91+
- ./setup.cfg:/src/setup.cfg:ro
92+
- ./setup.py:/src/setup.py:ro
93+
- ./tox.ini:/src/tox.ini:ro
94+
- ./.ddtox:/src/.tox
95+
command: bash

scripts/ddtest

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
docker-compose run --rm testrunner $*

0 commit comments

Comments
 (0)