Skip to content

Commit 7302a04

Browse files
committed
Add log ignore path test
1 parent d6fc902 commit 7302a04

3 files changed

Lines changed: 21 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.*.sw*
22
node_modules/
33
*.log
4+
testarea

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ And in the output you should see a `jwt` section.
7474
Set the environment variable `LOG_IGNORE_PATH` to a path you would like to exclude from verbose logging to stdout.
7575
This can help reduce noise from healthchecks in orchestration/infrastructure like Swarm, Kubernetes, ALBs, etc.
7676

77-
docker run -e LOG_IGNORE_PATH=/ping -e HTTP_PORT=8888 -e HTTPS_PORT=9999 -p 8080:8888 -p 8443:9999 --rm -t mendhak/http-https-echo
77+
docker run -e LOG_IGNORE_PATH=/ping -p 8080:80 -p 8443:443 --rm -t mendhak/http-https-echo
7878

7979

8080
With docker compose, this would be:
@@ -125,4 +125,6 @@ Will contain a `json` property in the response/output.
125125

126126
docker build -t mendhak/http-https-echo .
127127

128+
Run some tests to make sure features are working as expected.
128129

130+
./tests.sh

tests.sh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ function message {
1010
RESTORE=$(echo -en '\033[0m')
1111
RED=$(echo -en '\033[01;31m')
1212
GREEN=$(echo -en '\033[01;32m')
13-
YELLOW=$(echo -en '\033[00;33m')
14-
BLUE=$(echo -en '\033[00;34m')
15-
MAGENTA=$(echo -en '\033[00;35m')
16-
PURPLE=$(echo -en '\033[00;35m')
17-
CYAN=$(echo -en '\033[00;36m')
18-
LIGHTGRAY=$(echo -en '\033[00;37m')
19-
LRED=$(echo -en '\033[01;31m')
20-
LGREEN=$(echo -en '\033[01;32m')
21-
LYELLOW=$(echo -en '\033[01;33m')
22-
LBLUE=$(echo -en '\033[01;34m')
23-
LMAGENTA=$(echo -en '\033[01;35m')
24-
LPURPLE=$(echo -en '\033[01;35m')
25-
LCYAN=$(echo -en '\033[01;36m')
26-
WHITE=$(echo -en '\033[01;37m')
27-
28-
2913

3014
function failed {
3115
echo ${RED}$1${RESTORE}
@@ -150,7 +134,24 @@ message " Stop containers "
150134
docker stop http-echo-tests
151135

152136

137+
message " Start container with LOG_IGNORE_PATH "
138+
docker run -d --rm -e LOG_IGNORE_PATH=/ping --name http-echo-tests -p 8080:80 -p 8443:443 -t mendhak/http-https-echo
139+
sleep 5
140+
curl -s -k -X POST -d "banana" https://localhost:8443/ping > /dev/null
153141

142+
if [ $(docker logs http-echo-tests | wc -l) == 1 ] && \
143+
! [ $(docker logs http-echo-tests | grep banana) ]
144+
then
145+
passed "LOG_IGNORE_PATH ignored"
146+
else
147+
failed "LOG_IGNORE_PATH was not ignored"
148+
docker logs http-echo-tests
149+
exit 1
150+
fi
151+
152+
153+
message " Stop containers "
154+
docker stop http-echo-tests
154155

155156

156157
popd

0 commit comments

Comments
 (0)