Skip to content

Commit ccc4fb8

Browse files
committed
Fix testing
1 parent 9228f25 commit ccc4fb8

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env*
2+
!.env.dist

Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,10 @@ docker-test: test
2727
test: run-test cleanup-test
2828

2929
run-test:
30-
TEST_ADDR="${TEST_ADDR}" \
31-
IMAGE_TAG="${IMAGE_TAG}" \
32-
DMARC_SRG_UI_PASSWORD="public" \
33-
# Random port maybe free ?
34-
DMARC_SRG_HTTP_ADDRESS="8912" \
35-
docker-compose -f docker-compose-latest.test.yml up --exit-code-from=sut --abort-on-container-exit
30+
IMAGE_TAG="$(IMAGE_TAG)" \
31+
docker compose -f docker-compose-latest.test.yml up --exit-code-from=sut --abort-on-container-exit
3632

3733
cleanup-test:
3834
@echo "Stopping and removing the container"
39-
TEST_ADDR="${TEST_ADDR}" \
40-
IMAGE_TAG="${IMAGE_TAG}" \
41-
DMARC_SRG_UI_PASSWORD="public" \
42-
# Random port maybe free ?
43-
DMARC_SRG_HTTP_ADDRESS="8912" \
44-
docker-compose -f docker-compose-latest.test.yml down
35+
IMAGE_TAG="$(IMAGE_TAG)" \
36+
docker compose -f docker-compose-latest.test.yml down

docker-compose-latest.test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: test-bench
66
image: ${IMAGE_TAG}
77
environment:
8-
TEST_ADDR: ${TEST_ADDR}
8+
TEST_ADDR: dmarc-srg
99
volumes:
1010
- ./test.sh:/test.sh:ro
1111
entrypoint: ["/test.sh"]
@@ -16,6 +16,7 @@ services:
1616
dmarc-srg:
1717
image: ${IMAGE_TAG}
1818
container_name: dmarc-srg
19+
user: application
1920
healthcheck:
2021
test:
2122
[
@@ -36,7 +37,5 @@ services:
3637
IMAP_HOST: $DMARC_SRG_IMAP_HOST
3738
IMAP_USER: $DMARC_SRG_IMAP_USER
3839
IMAP_PASSWORD: $DMARC_SRG_IMAP_PASSWORD
39-
UI_PASSWORD: $DMARC_SRG_UI_PASSWORD
40-
ports:
41-
- ${DMARC_SRG_HTTP_ADDRESS:-8082}:80
40+
UI_PASSWORD: public
4241
restart: on-failure:2

test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ checkUrl() {
88
set +e
99
if [ "${2:-}" = "form" ]; then
1010
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --show-error --fail-with-body \
11-
-s \
1211
-H 'Accept: application/json' \
1312
-H 'Content-Type: application/json' \
1413
-L \
1514
--data-raw "${3}" \
1615
"$1"
1716
else
1817
curl -# --cookie-jar /tmp/test.cookie-jar -b /tmp/test.cookie-jar --show-error --fail-with-body \
19-
-s \
2018
${2:-} \
2119
-H 'Content-Type: application/json' \
2220
"$1"
@@ -40,7 +38,7 @@ checkUrl "http://${TEST_ADDR}/robots.txt" -I
4038
checkUrl "http://${TEST_ADDR}/css/main.css" -I | grep -F "Cache-Control: max-age=86400"
4139

4240
checkUrl "http://${TEST_ADDR}/index.php" | grep -q -F "DMARC Reports"
43-
checkUrl "http://${TEST_ADDR}/login.php" "form" "{"password":"public"}" | grep -q -F "Successfully logged into server."
41+
checkUrl "http://${TEST_ADDR}/login.php" "form" '{"password":"public"}' | grep -q -F "Authentication succeeded"
4442

4543
if [ $DID_FAIL -gt 0 ]; then
4644
echo "Some URLs failed"

0 commit comments

Comments
 (0)