diff options
author | VirtualTam <virtualtam@flibidi.net> | 2017-05-30 23:45:17 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2017-09-18 21:13:59 +0200 |
commit | d691604080cc920e7d1d7ad5c98f4e3fae779524 (patch) | |
tree | 56a576fa9350f468c9fcfa7db9f8e2ed8e4ff2df /doc/md | |
parent | ceb738c59163b47e9c875764c9d3223bbc1eba24 (diff) | |
download | Shaarli-d691604080cc920e7d1d7ad5c98f4e3fae779524.tar.gz Shaarli-d691604080cc920e7d1d7ad5c98f4e3fae779524.tar.zst Shaarli-d691604080cc920e7d1d7ad5c98f4e3fae779524.zip |
docker: add alpine,debian,ubuntu test images
Relates to https://github.com/shaarli/Shaarli/issues/843
Added:
- Makefile target to run commands in a Docker test context
- Docker images to run Shaarli test suites:
- Alpine 3.6
- Debian 8
- Debian 9
- Ubuntu 16.04
- Documentation
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'doc/md')
-rw-r--r-- | doc/md/Unit-tests-Docker.md | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/md/Unit-tests-Docker.md b/doc/md/Unit-tests-Docker.md new file mode 100644 index 00000000..c2de7cc7 --- /dev/null +++ b/doc/md/Unit-tests-Docker.md | |||
@@ -0,0 +1,56 @@ | |||
1 | ## Running tests inside Docker containers | ||
2 | |||
3 | Read first: | ||
4 | |||
5 | - [Docker 101](docker/docker-101.md) | ||
6 | - [Docker resources](docker/resources.md) | ||
7 | - [Unit tests](Unit-tests.md) | ||
8 | |||
9 | ### Docker test images | ||
10 | |||
11 | Test Dockerfiles are located under `docker/tests/<distribution>/Dockerfile`, | ||
12 | and can be used to build Docker images to run Shaarli test suites under common | ||
13 | Linux environments. | ||
14 | |||
15 | Dockerfiles are provided for the following environments: | ||
16 | |||
17 | - `alpine36` - [Alpine 3.6](https://www.alpinelinux.org/downloads/) | ||
18 | - `debian8` - [Debian 8 Jessie](https://www.debian.org/DebianJessie) (oldstable) | ||
19 | - `debian9` - [Debian 9 Stretch](https://wiki.debian.org/DebianStretch) (stable) | ||
20 | - `ubuntu16` - [Ubuntu 16.04 Xenial Xerus](http://releases.ubuntu.com/16.04/) (LTS) | ||
21 | |||
22 | What's behind the curtains: | ||
23 | |||
24 | - each image provides: | ||
25 | - a base Linux OS | ||
26 | - Shaarli PHP dependencies (OS packages) | ||
27 | - test PHP dependencies (OS packages) | ||
28 | - Composer | ||
29 | - the local workspace is mapped to the container's `/shaarli/` directory, | ||
30 | - the files are rsync'd to so tests are run using a standard Linux user account | ||
31 | (running tests as `root` would bypass permission checks and may hide issues) | ||
32 | - the tests are run inside the container. | ||
33 | |||
34 | ### Building test images | ||
35 | |||
36 | ```bash | ||
37 | # build the Debian 9 Docker image | ||
38 | $ cd /path/to/shaarli | ||
39 | $ cd docker/test/debian9 | ||
40 | $ docker build -t shaarli-test:debian9 . | ||
41 | ``` | ||
42 | |||
43 | ### Running tests | ||
44 | |||
45 | ```bash | ||
46 | $ cd /path/to/shaarli | ||
47 | |||
48 | # install/update 3rd-party test dependencies | ||
49 | $ composer install --prefer-dist | ||
50 | |||
51 | # run tests using the freshly built image | ||
52 | $ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_test | ||
53 | |||
54 | # run the full test campaign | ||
55 | $ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_all_tests | ||
56 | ``` | ||