forked from aws/aws-lambda-java-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_invocation_test.sh
executable file
·41 lines (36 loc) · 1.29 KB
/
run_invocation_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
set -euxo pipefail
echo "Running Image ${IMAGE_TAG}"
docker network create "${OS_DISTRIBUTION}-network"
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
--platform="${PLATFORM}" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
sleep 2
# running on arm64 hosts with x86_64 being emulated takes significantly more time than any other combination
if [[ "$(arch)" == "aarch64" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then
declare -i time_out=150
else
declare -i time_out=10
fi
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--env "MAX_TIME=${time_out}" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
--platform="${PLATFORM}" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time ${MAX_TIME}'
actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
expected='success'
echo "Response: ${actual}"
if [[ "${actual}" != "${expected}" ]]; then
echo "fail! runtime: ${RUNTIME} - expected output ${expected} - got ${actual}"
exit 1
fi