Skip to content

Commit a451e7e

Browse files
committed
Fix tests
1 parent fea5a14 commit a451e7e

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

test/integration/local_lambda/test_end_to_end.py

+34-1
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ def tearDownClass(cls):
5353
"remaining_time_in_default_deadline",
5454
"pre-runtime-api",
5555
"assert-overwritten",
56+
"assert-overwritten-consistent",
57+
"arnexists-consistent",
5658
]
5759

5860
for image in images_to_delete:
5961
for arch in ARCHS:
6062
arch_tag = "" if arch == "" else f"-{arch}"
6163
cmd = f"docker rm -f {image}{arch_tag}"
6264
Popen(cmd.split(" ")).communicate()
63-
65+
6466
for arch in ARCHS:
6567
arch_tag = "" if arch == "" else f"-{arch}"
6668
Popen(f"docker rmi {cls.image_name}{arch_tag}".split(" ")).communicate()
@@ -264,6 +266,37 @@ def test_function_name_is_overriden(self, arch, port):
264266
)
265267
self.assertEqual(b'"My lambda ran succesfully"', r.content)
266268

269+
@parameterized.expand([("x86_64", "8011"), ("arm64", "9011"), ("", "9061")])
270+
def test_function_name_is_overriden_consistent(self, arch, port):
271+
image, rie, image_name = self.tagged_name("assert-overwritten-consistent", arch)
272+
273+
cmd = f"docker run --name {image} -d --env AWS_LAMBDA_FUNCTION_NAME=MyCoolName --env AWS_LAMBDA_RIE_INCONSISTENT_BEHAVIOUR=FALSE -v {self.path_to_binary}:/local-lambda-runtime-server -p {port}:8080 --entrypoint /local-lambda-runtime-server/{rie} {image_name} {DEFAULT_1P_ENTRYPOINT} main.assert_env_var_is_overwritten"
274+
275+
Popen(cmd.split(" ")).communicate()
276+
277+
# sleep 1s to give enough time for the endpoint to be up to curl
278+
time.sleep(SLEEP_TIME)
279+
280+
r = requests.post(
281+
f"http://localhost:{port}/2015-03-31/functions/MyCoolName/invocations", json={}
282+
)
283+
self.assertEqual(b'"My lambda ran succesfully"', r.content)
284+
285+
@parameterized.expand([("x86_64", "8012"), ("arm64", "9012"), ("", "9062")])
286+
def test_lambda_function_arn_exists(self, arch, port):
287+
image, rie, image_name = self.tagged_name("arnexists-consistent", arch)
288+
289+
cmd = f"docker run --name {image} -d --env AWS_LAMBDA_FUNCTION_NAME=MyCoolName --env AWS_LAMBDA_RIE_INCONSISTENT_BEHAVIOUR=FALSE -v {self.path_to_binary}:/local-lambda-runtime-server -p {port}:8080 --entrypoint /local-lambda-runtime-server/{rie} {image_name} {DEFAULT_1P_ENTRYPOINT} main.assert_lambda_arn_in_context"
290+
291+
Popen(cmd.split(" ")).communicate()
292+
293+
# sleep 1s to give enough time for the endpoint to be up to curl
294+
time.sleep(SLEEP_TIME)
295+
296+
r = requests.post(
297+
f"http://localhost:{port}/2015-03-31/functions/MyCoolName/invocations", json={}
298+
)
299+
self.assertEqual(b'"My lambda ran succesfully"', r.content)
267300

268301
if __name__ == "__main__":
269302
main()

0 commit comments

Comments
 (0)