Skip to content

Commit c7efdc5

Browse files
authored
Merge pull request #69 from aws/test/proxy-regression
test: add dockerized regression test for the proxy-bypass fix
2 parents 80e418d + eb2551c commit c7efdc5

6 files changed

Lines changed: 75 additions & 1 deletion

File tree

‎.github/workflows/dockerized-test.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,13 @@ jobs:
3939
suiteFileArray: '["./test/dockerized/suites/*.json"]'
4040
dockerImageName: 'local/test'
4141
taskFolder: './test/dockerized/tasks'
42+
43+
- name: Build the proxy image
44+
run: docker build . -t local/test-proxy -f Dockerfile.test.proxy
45+
46+
- name: Run proxy tests
47+
uses: aws/containerized-test-runner-for-aws-lambda@511d270614f2c6b1613848db6dcf920a591c3c89 # main
48+
with:
49+
suiteFileArray: '["./test/dockerized/suites/proxy/*.json"]'
50+
dockerImageName: 'local/test-proxy'
51+
taskFolder: './test/dockerized/tasks'

‎Dockerfile.test‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ ADD test/dockerized/tasks /var/task
55
RUN gem uninstall aws_lambda_ric --executables
66
ADD pkg /tmp/pkg
77
RUN gem install /tmp/pkg/aws_lambda_ric-*.gem
8-
RUN rm -rf /tmp/pkg
8+
RUN rm -rf /tmp/pkg

‎Dockerfile.test.proxy‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Variant of Dockerfile.test used only for the proxy-regression suite.
2+
# Extends the standard test image with an unreachable HTTP_PROXY and an
3+
# entrypoint that binds RIE's Runtime API to the container's own
4+
# non-loopback hostname. Kept separate from Dockerfile.test so the other
5+
# suites keep running against a plain RIE-on-loopback setup.
6+
#
7+
# Requires local/test to be built first (see .github/workflows/dockerized-test.yml).
8+
FROM local/test
9+
10+
ENV HTTP_PROXY=http://127.0.0.1:1
11+
ENV http_proxy=http://127.0.0.1:1
12+
13+
COPY test/dockerized/entrypoint.sh /entrypoint.sh
14+
RUN chmod +x /entrypoint.sh
15+
ENTRYPOINT ["/entrypoint.sh"]

‎test/dockerized/entrypoint.sh‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
5+
set -eu
6+
7+
if [ "$#" -ne 1 ]; then
8+
echo "entrypoint requires the handler name as first argument" 1>&2
9+
exit 142
10+
fi
11+
export _HANDLER="$1"
12+
13+
# Resolve the container's own hostname to its non-loopback IPv4 (docker
14+
# writes this to /etc/hosts for us on eth0).
15+
RIC_HOST="$(getent hosts "$HOSTNAME" | awk '{print $1; exit}')"
16+
if [ -z "$RIC_HOST" ]; then
17+
echo "entrypoint could not resolve \$HOSTNAME ($HOSTNAME)" 1>&2
18+
exit 143
19+
fi
20+
21+
exec /usr/local/bin/aws-lambda-rie \
22+
--runtime-api-address "$RIC_HOST:9001" \
23+
/var/runtime/bootstrap
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"tests": [
3+
{
4+
"name": "test_ric_bypasses_http_proxy",
5+
"handler": "proxy.check_proxy_bypass",
6+
"request": {},
7+
"assertions": [
8+
{
9+
"response": "success"
10+
}
11+
]
12+
}
13+
]
14+
}

‎test/dockerized/tasks/proxy.rb‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# The image (see Dockerfile.test) runs with HTTP_PROXY pointed at an
4+
# unreachable address and RIE's Runtime API bound to a non-loopback
5+
# hostname. If the proxy-bypass fix (PR #68) is in place the RIC bypasses
6+
# HTTP_PROXY for Runtime API calls and this handler runs to completion,
7+
# returning "success". Without the fix the RIC would try to reach the
8+
# unreachable proxy for next_invocation and this handler would never run.
9+
10+
def check_proxy_bypass(event:, context:)
11+
'success'
12+
end

0 commit comments

Comments
 (0)