Skip to content

Commit

Permalink
Upgrade to cli v2
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverdaff committed Jan 16, 2024
1 parent 6f015f7 commit 7f7c860
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test:
# Sleep for 20s in between to let CI complete execution
test-examples:
./scripts/run_example.sh
sleep 20
sleep 1
./scripts/read_and_validate_logs.sh

## fmt: format all code using standard conventions
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ services:
- AWS_DEFAULT_REGION=ap-southeast-2
- AWS_ACCESS_KEY_ID=placeholder
- AWS_SECRET_ACCESS_KEY=placeholder
- AWS_PAGER=""
depends_on:
- localstack

Expand Down
17 changes: 16 additions & 1 deletion scripts/read_and_validate_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ export DEFAULT_REGION=ap-southeast-2
export EXPECTED_MESSAGE="hello, world!"

# Read the logs

export GROUP_NAME="/aws/lambda/${EXAMPLE}"

if ! timeout 60 bash -c '
count=0
while true; do
if '"${AWSLOCAL}"' logs describe-log-groups --log-group-name-prefix "'${GROUP_NAME}'" | grep -q "'${GROUP_NAME}'"; then
exit 0
fi
sleep 1
((count++))
if ((count % 1 == 0)); then
echo "Still waiting for log group '"${GROUP_NAME}"' to appear..."
fi
done
'; then
echo "Error: Timed out waiting for log group ${GROUP_NAME} to appear."
fi

export STREAM_NAME=`$AWSLOCAL logs describe-log-streams --log-group-name $GROUP_NAME | jq -r '.logStreams[].logStreamName'`
if [ -z "$STREAM_NAME" ] || [ "$STREAM_NAME" = "null" ]; then
echo "Failed to determine stream name"
Expand Down
2 changes: 2 additions & 0 deletions scripts/run_example.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set -ex

# Disable AWS CLI paging feature
export AWS_PAGER=""
# Choose the example to run
export EXAMPLE=hello_lambda

Expand Down

0 comments on commit 7f7c860

Please sign in to comment.