@@ -53,14 +53,16 @@ def tearDownClass(cls):
53
53
"remaining_time_in_default_deadline" ,
54
54
"pre-runtime-api" ,
55
55
"assert-overwritten" ,
56
+ "assert-overwritten-consistent" ,
57
+ "arnexists-consistent" ,
56
58
]
57
59
58
60
for image in images_to_delete :
59
61
for arch in ARCHS :
60
62
arch_tag = "" if arch == "" else f"-{ arch } "
61
63
cmd = f"docker rm -f { image } { arch_tag } "
62
64
Popen (cmd .split (" " )).communicate ()
63
-
65
+
64
66
for arch in ARCHS :
65
67
arch_tag = "" if arch == "" else f"-{ arch } "
66
68
Popen (f"docker rmi { cls .image_name } { arch_tag } " .split (" " )).communicate ()
@@ -264,6 +266,37 @@ def test_function_name_is_overriden(self, arch, port):
264
266
)
265
267
self .assertEqual (b'"My lambda ran succesfully"' , r .content )
266
268
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 )
267
300
268
301
if __name__ == "__main__" :
269
302
main ()
0 commit comments