Skip to content

Commit 3c16423

Browse files
committed
Ref #369 - Add tests for a different Apache2 port
1 parent 0b7054a commit 3c16423

File tree

5 files changed

+79
-3
lines changed

5 files changed

+79
-3
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
database-image: ["mariadb:10.4", "mysql:5.7", "mariadb:latest", "mysql:latest"]
18-
configuration: ["default", "one-host"]
18+
configuration: ["default", "one-host", "different-apache-port"]
1919

2020
steps:
2121
- uses: actions/checkout@v3

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ run:
2121
testing-%:
2222
docker-compose -f ./testing/docker-compose/docker-compose.$@.yml up --build --abort-on-container-exit --exit-code-from=sut
2323

24-
run-tests: testing-default testing-one-host
24+
run-tests: testing-default testing-one-host testing-different-apache-port
2525

2626
logs:
2727
docker-compose -f ./testing/docker-compose/docker-compose.testing-default.yml logs

testing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ FROM alpine:3.15
66
RUN set -ex; \
77
\
88
apk add --no-cache --update mariadb-client mariadb-connector-c bash \
9-
py3-html5lib py3-pytest py3-mechanize
9+
py3-html5lib py3-pytest py3-mechanize curl
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: "3.1"
2+
3+
services:
4+
db_server:
5+
image: ${DB:-mariadb:10.3}
6+
container_name: phpmyadmin_testing_db
7+
environment:
8+
MYSQL_ROOT_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
9+
healthcheck:
10+
test: ["CMD", "mysqladmin", "ping", "-uroot", "-p${TESTSUITE_PASSWORD:-my-secret-pw}"]
11+
start_period: 5s
12+
interval: 5s
13+
timeout: 60s
14+
retries: 10
15+
networks:
16+
testing:
17+
tmpfs:
18+
- /var/lib/mysql:rw,noexec,nosuid,size=300m
19+
20+
phpmyadmin:
21+
build:
22+
context: ../../apache
23+
container_name: phpmyadmin_testing_apache
24+
environment:
25+
PMA_HOST: db_server
26+
UPLOAD_LIMIT: 123M
27+
MAX_EXECUTION_TIME: 125
28+
HIDE_PHP_VERSION: 1
29+
APACHE_PORT: 8090
30+
volumes:
31+
- ../config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
32+
healthcheck:
33+
test: ["CMD", "curl", "-Ss", "http://localhost:8090/robots.txt"]
34+
start_period: 5s
35+
interval: 3s
36+
timeout: 60s
37+
retries: 10
38+
networks:
39+
testing:
40+
depends_on:
41+
db_server:
42+
condition: service_healthy
43+
44+
sut:
45+
depends_on:
46+
phpmyadmin:
47+
condition: service_healthy
48+
db_server:
49+
condition: service_healthy
50+
build:
51+
context: ../
52+
command: "/tests/testing/test-docker.sh"
53+
networks:
54+
testing:
55+
environment:
56+
TESTSUITE_HOSTNAME: phpmyadmin_testing_apache
57+
TESTSUITE_PORT: 8090
58+
TESTSUITE_PASSWORD: "${TESTSUITE_PASSWORD:-my-secret-pw}"
59+
PMA_HOST: phpmyadmin_testing_db
60+
PMA_PORT: 3306
61+
volumes:
62+
- ../../:/tests:ro
63+
- /var/run/docker.sock:/var/run/docker.sock
64+
working_dir: /tests
65+
66+
networks:
67+
testing:
68+
driver: bridge

testing/test-docker.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ if [ $ret -ne 0 ] ; then
2828
exit $ret
2929
fi
3030

31+
curl -fsSL --output /dev/null "${PHPMYADMIN_URL}"
32+
ret=$?
33+
34+
if [ $ret -ne 0 ] ; then
35+
echo "Could not connect to ${PHPMYADMIN_URL}"
36+
exit $ret
37+
fi
38+
3139
# Perform tests
3240
ret=0
3341
pytest -p no:cacheprovider -q --url "$PHPMYADMIN_URL" --username ${TESTSUITE_USER:=root} --password "$TESTSUITE_PASSWORD" $SERVER $FILENAME

0 commit comments

Comments
 (0)