Skip to content

Commit 084dd87

Browse files
authored
Merge pull request #1 from geekstuff-it/base-auto-tests
Add base for automated testing
2 parents 97be4c9 + 821cc0d commit 084dd87

File tree

6 files changed

+82
-3
lines changed

6 files changed

+82
-3
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,26 @@
33
Base docker image for docker apache mod-php.
44

55
This is a work in progress for now. Will get cleaned up over time.
6+
7+
8+
## TODO
9+
10+
### Write tests
11+
12+
#### Web tests
13+
- Run web container test as php user, since we don't expect much issues from root.
14+
- test a non existing web endpoint
15+
- test existing web endpoint
16+
- test endpoint that writes session data
17+
- test endpoint that tries to write to / folder
18+
- test executing privileged shell command
19+
20+
#### Cli
21+
- test workdir
22+
- test composer in path
23+
- test some of the dockerfile stuff (to be defined)
24+
25+
#### Dev
26+
- we could build a 2nd web-dev container and run dev specific tests there.
27+
- an xdebug test could be done but not as relevant since no network issues expected.
28+
- opcache not caching file changes in dev context is maybe doable

docker-compose.test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: "3.6"
2+
3+
services:
4+
sut:
5+
build:
6+
context: test/
7+
links:
8+
- php
9+
#- php71
10+
#- php72
11+
#- php73
12+
#- php74
13+
php:
14+
build: .
15+
user: php
16+
17+
# The following is probably not the best way to go about it. It would run 4x this image at once.
18+
# Keeping as a note until we try test hooks.
19+
#
20+
#php71:
21+
# user: php
22+
# build:
23+
# context: .
24+
# args:
25+
# PHP_VERSION_TAG: 7.1-apache
26+
#php72:
27+
# user: php
28+
# build:
29+
# context: .
30+
# args:
31+
# PHP_VERSION_TAG: 7.2-apache
32+
#php73:
33+
# user: php
34+
# build:
35+
# context: .
36+
# args:
37+
# PHP_VERSION_TAG: 7.3-apache
38+
#php74:
39+
# user: php
40+
# build:
41+
# context: .
42+
# args:
43+
# PHP_VERSION_TAG: 7.4-apache

hooks/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

33

4-
docker build -f $DOCKERFILE_PATH -t ${IMAGE_NAME} .
54

65
if [ $DOCKER_TAG == "latest" ]; then
6+
docker build -f $DOCKERFILE_PATH -t ${IMAGE_NAME} .
77
docker build --build-arg PHP_VERSION_TAG=7.1-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.1-latest .
88
docker build --build-arg PHP_VERSION_TAG=7.2-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.2-latest .
99
docker build --build-arg PHP_VERSION_TAG=7.3-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.3-latest .

hooks/post_push

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
set -e
55

6-
docker push $IMAGE_NAME
7-
86
if [ $DOCKER_TAG == "latest" ]; then
7+
docker push $IMAGE_NAME
98
docker push $DOCKER_REPO:7.1-latest
109
docker push $DOCKER_REPO:7.2-latest
1110
docker push $DOCKER_REPO:7.3-latest

test/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:trusty
2+
3+
RUN apt-get update && apt-get install -yq curl netcat && apt-get clean
4+
5+
WORKDIR /app
6+
7+
ADD test.sh /app/test.sh
8+
9+
CMD ["bash", "test.sh"]

test/test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
4+
# TODO write tests
5+
exit 0

0 commit comments

Comments
 (0)