@@ -27,15 +27,15 @@ if ! [ -x "$(command -v jq)" ]; then
2727fi
2828
2929message " Check if we're in Github Actions "
30- if [ -n " ${GITHUB_ACTIONS} " ]; then
30+ if [ -n " ${GITHUB_ACTIONS:- } " ]; then
3131 docker images
32- if [ -z " $( docker images -q mendhak/http-https-echo:latest 2> /dev/null) " ]; then
33- echo " Docker image mendhak/http-https-echo:latest not found. Exiting."
32+ if [ -z " $( docker images -q mendhak/http-https-echo:testing 2> /dev/null) " ]; then
33+ echo " Docker image mendhak/http-https-echo:testing not found. Exiting."
3434 exit 1
3535 fi
3636else
3737 message " Local run. Build image "
38- docker build -t mendhak/http-https-echo:latest .
38+ docker build -t mendhak/http-https-echo:testing .
3939fi
4040
4141
@@ -46,7 +46,7 @@ message " Cleaning up from previous test run "
4646docker ps -aq --filter " name=http-echo-tests" | grep -q . && docker stop http-echo-tests && docker rm -f http-echo-tests
4747
4848message " Start container normally "
49- docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
49+ docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
5050sleep 5
5151
5252
@@ -159,7 +159,7 @@ docker stop http-echo-tests
159159sleep 5
160160
161161message " Start container with different internal ports "
162- docker run -d --rm -e HTTP_PORT=8888 -e HTTPS_PORT=9999 --name http-echo-tests -p 8080:8888 -p 8443:9999 -t mendhak/http-https-echo
162+ docker run -d --rm -e HTTP_PORT=8888 -e HTTPS_PORT=9999 --name http-echo-tests -p 8080:8888 -p 8443:9999 -t mendhak/http-https-echo:testing
163163sleep 5
164164
165165message " Make http(s) request, and test the path, method and header. "
@@ -193,7 +193,7 @@ docker stop http-echo-tests
193193sleep 5
194194
195195message " Start container with empty responses "
196- docker run -d --rm -e ECHO_BACK_TO_CLIENT=false --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
196+ docker run -d --rm -e ECHO_BACK_TO_CLIENT=false --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
197197sleep 5
198198REQUEST=$( curl -s -k http://localhost:8080/a/b/c)
199199if [[ -z ${REQUEST} ]]
@@ -210,7 +210,7 @@ docker stop http-echo-tests
210210sleep 5
211211
212212message " Start container with response body only "
213- docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
213+ docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
214214sleep 5
215215RESPONSE=$( curl -s -k -X POST -d ' cauliflower' http://localhost:8080/a/b/c? response_body_only=true)
216216if [[ ${RESPONSE} == " cauliflower" ]]
@@ -228,7 +228,7 @@ docker stop http-echo-tests
228228sleep 5
229229
230230message " Start container with JWT_HEADER "
231- docker run -d --rm -e JWT_HEADER=Authentication --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
231+ docker run -d --rm -e JWT_HEADER=Authentication --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
232232sleep 5
233233
234234REQUEST=$( curl -s -k -H " Authentication: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" https://localhost:8443/ )
@@ -249,7 +249,7 @@ sleep 5
249249
250250
251251message " Start container with LOG_IGNORE_PATH "
252- docker run -d --rm -e LOG_IGNORE_PATH=/ping --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
252+ docker run -d --rm -e LOG_IGNORE_PATH=/ping --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
253253sleep 5
254254curl -s -k -X POST -d " banana" https://localhost:8443/ping > /dev/null
255255
@@ -269,7 +269,7 @@ docker stop http-echo-tests
269269sleep 5
270270
271271message " Start container with DISABLE_REQUEST_LOGS "
272- docker run -d --rm -e DISABLE_REQUEST_LOGS=true --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
272+ docker run -d --rm -e DISABLE_REQUEST_LOGS=true --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
273273sleep 5
274274curl -s -k -X GET https://localhost:8443/strawberry > /dev/null
275275if [ $( docker logs http-echo-tests | grep -c " GET /strawberry HTTP/1.1" ) -eq 0 ]
@@ -288,7 +288,7 @@ sleep 5
288288message " Start container with CORS_CONFIG"
289289docker run -d --rm \
290290 -e CORS_ALLOW_ORIGIN=" http://example.com" -e CORS_ALLOW_HEADERS=" x-custom-test-header" \
291- --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
291+ --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
292292sleep 5
293293# Check if the expected CORS headers are present in the response
294294if curl -s -i http://localhost:8080/ 2>&1 | grep -q -E \
@@ -307,7 +307,7 @@ docker stop http-echo-tests
307307sleep 5
308308
309309message " Start container with LOG_WITHOUT_NEWLINE "
310- docker run -d --rm -e LOG_WITHOUT_NEWLINE=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
310+ docker run -d --rm -e LOG_WITHOUT_NEWLINE=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
311311sleep 5
312312curl -s -k -X POST -d " tiramisu" https://localhost:8443/ > /dev/null
313313
@@ -327,7 +327,7 @@ docker stop http-echo-tests
327327sleep 5
328328
329329message " Check that container is running as a NON ROOT USER by default"
330- docker run -d --name http-echo-tests --rm mendhak/http-https-echo
330+ docker run -d --name http-echo-tests --rm mendhak/http-https-echo:testing
331331
332332WHOAMI=$( docker exec http-echo-tests whoami)
333333
@@ -344,9 +344,9 @@ docker stop http-echo-tests
344344sleep 5
345345
346346message " Check that container is running as user different that the user defined in image"
347- IMAGE_USER=" $( docker image inspect mendhak/http-https-echo -f ' {{ .Config.User }}' ) "
347+ IMAGE_USER=" $( docker image inspect mendhak/http-https-echo:testing -f ' {{ .Config.User }}' ) "
348348CONTAINER_USER=" $(( IMAGE_USER + 1000000 )) "
349- docker run -d --name http-echo-tests --rm -u " ${CONTAINER_USER} " -p 8080:8080 mendhak/http-https-echo
349+ docker run -d --name http-echo-tests --rm -u " ${CONTAINER_USER} " -p 8080:8080 mendhak/http-https-echo:testing
350350sleep 5
351351curl -s http://localhost:8080 > /dev/null
352352
@@ -369,7 +369,7 @@ message " Check that mTLS server responds with client certificate details"
369369openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout privkey.pem -out fullchain.pem \
370370 -subj " /CN=client.example.net" \
371371 -addext " subjectAltName=DNS:client.example.net"
372- docker run -d --rm -e MTLS_ENABLE=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
372+ docker run -d --rm -e MTLS_ENABLE=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
373373sleep 5
374374COMMON_NAME=" $( curl -sk --cert fullchain.pem --key privkey.pem https://localhost:8443/ | jq -r ' .clientCertificate.subject.CN' ) "
375375SAN=" $( curl -sk --cert fullchain.pem --key privkey.pem https://localhost:8443/ | jq -r ' .clientCertificate.subjectaltname' ) "
@@ -422,7 +422,7 @@ docker run -d --rm \
422422 -e HTTPS_CERT_FILE=" ${container_https_cert_file} " \
423423 -v " ${https_key_file} :${container_https_key_file} :ro,z" \
424424 -e HTTPS_KEY_FILE=" ${container_https_key_file} " \
425- --name http-echo-tests -p 8443:8443 -t mendhak/http-https-echo
425+ --name http-echo-tests -p 8443:8443 -t mendhak/http-https-echo:testing
426426sleep 5
427427
428428REQUEST_WITH_STATUS_CODE=" $( curl -s --cacert " $( pwd) /server_fullchain.pem" -o /dev/null -w " %{http_code}" \
@@ -440,7 +440,7 @@ docker stop http-echo-tests
440440sleep 5
441441
442442message " Check that environment variables returned in response if enabled"
443- docker run -d --rm -e ECHO_INCLUDE_ENV_VARS=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
443+ docker run -d --rm -e ECHO_INCLUDE_ENV_VARS=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
444444sleep 5
445445RESPONSE_BODY=" $( curl -sk https://localhost:8443/ | jq -r ' .env.ECHO_INCLUDE_ENV_VARS' ) "
446446
@@ -457,7 +457,7 @@ docker stop http-echo-tests
457457sleep 5
458458
459459message " Check that environment variables are not present in response by default"
460- docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
460+ docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
461461sleep 5
462462RESPONSE_BODY_ENV_CHECK=" $( curl -sk https://localhost:8443/ | jq ' has("env")' ) "
463463
@@ -474,7 +474,7 @@ docker stop http-echo-tests
474474sleep 5
475475
476476message " Start container with PROMETHEUS disabled "
477- docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
477+ docker run -d --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
478478sleep 5
479479curl -s -k -X POST -d " tiramisu" https://localhost:8443/ > /dev/null
480480
@@ -495,7 +495,7 @@ docker stop http-echo-tests
495495sleep 5
496496
497497message " Start container with PROMETHEUS enabled "
498- docker run -d -e PROMETHEUS_ENABLED=true --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
498+ docker run -d -e PROMETHEUS_ENABLED=true --rm --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo:testing
499499sleep 5
500500curl -s -k -X POST -d " tiramisu" https://localhost:8443/ > /dev/null
501501
0 commit comments