test(handlers): add health check to coverage build (#1684)

* test(handlers): add health check to coverage build

This change ensures that the integration test container also utilises the health check script to ensure coverage for this area of code.

* update health check script for coverage container

* remove start period and ignore cert check
pull/1687/head
Amir Zarrinkafsh 2021-02-03 10:17:46 +11:00 committed by GitHub
parent 23f8a059fe
commit ac92643212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -57,6 +57,7 @@ RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
COPY healthcheck.sh /usr/local/bin/
EXPOSE 9091
@ -65,3 +66,4 @@ VOLUME /config
ENV PATH="/app:${PATH}"
CMD ["authelia", "-test.coverprofile=/authelia/coverage.txt", "COVERAGE", "--config", "/config/configuration.yml"]
HEALTHCHECK --interval=30s --timeout=3s CMD /usr/local/bin/healthcheck.sh

View File

@ -1,6 +1,6 @@
#!/bin/sh
AUTHELIA_CONFIG=$(pgrep -af authelia | awk '{print $4}')
AUTHELIA_CONFIG=$(pgrep -af authelia | awk '{print $NF}')
AUTHELIA_SCHEME=$(grep ^tls "${AUTHELIA_CONFIG}")
AUTHELIA_HOST=$(grep ^host "${AUTHELIA_CONFIG}" | sed -e 's/host: //' -e 's/\r//')
AUTHELIA_PORT=$(grep ^port "${AUTHELIA_CONFIG}" | sed -e 's/port: //' -e 's/\r//')
@ -20,4 +20,4 @@ if [ -z "${AUTHELIA_PORT}" ]; then
AUTHELIA_PORT=9091
fi
wget --quiet --tries=1 --spider "${AUTHELIA_SCHEME}://${AUTHELIA_HOST}:${AUTHELIA_PORT}${AUTHELIA_PATH}/api/health" || exit 1
wget --quiet --no-check-certificate --tries=1 --spider "${AUTHELIA_SCHEME}://${AUTHELIA_HOST}:${AUTHELIA_PORT}${AUTHELIA_PATH}/api/health" || exit 1