Skip to content

Commit

Permalink
Report log output when testing monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Jun 22, 2024
1 parent 286e2bd commit 489f390
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tools/autograph-client/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ services:
- monitor-lambda-emulator
depends_on:
- monitor-lambda-emulator
command: [ "curl", "-XPOST", "http://monitor-lambda-emulator:8080/2015-03-31/functions/function/invocations", "-d{}" ]
volumes:
- apptmpdir:/tmp/
command: [ "./integration_test_monitor.sh", "http://monitor-lambda-emulator:8080" ]

test-monitor-hsm:
container_name: test-monitor-hsm
Expand All @@ -77,4 +79,6 @@ services:
- monitor-hsm-lambda-emulator
depends_on:
- monitor-hsm-lambda-emulator
command: [ "curl", "-XPOST", "http://monitor-hsm-lambda-emulator:8080/2015-03-31/functions/function/invocations", "-d{}" ]
volumes:
- hsmtmpdir:/tmp/
command: [ "./integration_test_monitor.sh", "http://monitor-hsm-lambda-emulator:8080" ]
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
set -e
set -o pipefail

MONITOR_ENDPOINT=${1:-"http://localhost:8080"}

# invoke a test monitor run in a lambda monitor
MONITOR_ERROR=$(curl -w '\n' -X POST 'http://localhost:8080/2015-03-31/functions/function/invocations' -d '{}')
MONITOR_ERROR=$(curl --silent -w '\n' -X POST "${MONITOR_ENDPOINT}/2015-03-31/functions/function/invocations" -d '{}')

# Dump the log file, if it exists
if [ -f "/tmp/autograph-lambda-logs.txt" ]; then
cat /tmp/autograph-lambda-logs.txt
fi

# If the result was null - then we succeeded!
if [ "${MONITOR_ERROR}" == "null" ]; then
Expand Down
1 change: 0 additions & 1 deletion tools/autograph-monitor/Dockerfile.lambda-emulator
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM autograph-app

USER root

RUN cp /app/src/autograph/bin/test_monitor.sh /usr/local/bin/test_monitor.sh
RUN curl -Lo /usr/local/bin/aws-lambda-rie \
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
chmod +x /usr/local/bin/aws-lambda-rie
Expand Down
3 changes: 3 additions & 0 deletions tools/autograph-monitor/lambda-setup-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
set -e
set -o pipefail

# Duplicate the console output to a file.
exec &> >(tee /tmp/autograph-lambda-logs.txt)

# Wait for the heartbeat
HEARTBEAT=$(curl --silent \
--connect-timeout 5 \
Expand Down

0 comments on commit 489f390

Please sign in to comment.