Skip to content

Commit cb1fbb7

Browse files
committed
Fix tests
1 parent ff9e4f1 commit cb1fbb7

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

Diff for: test/integration/local_lambda/test_end_to_end.py

+23-3
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def run_command(self, cmd):
6565
def sleep_1s(self):
6666
time.sleep(SLEEP_TIME)
6767

68-
def invoke_function(self, json={}, headers={}):
68+
def invoke_function(self, json={}, headers={}, function_name="function"):
6969
return requests.post(
70-
f"http://localhost:{self.PORT}/2015-03-31/functions/function/invocations",
70+
f"http://localhost:{self.PORT}/2015-03-31/functions/{function_name}/invocations",
7171
json=json,
7272
headers=headers,
7373
)
@@ -257,5 +257,25 @@ def test_custom_client_context(self):
257257
self.assertEqual(123, content["baz"])
258258

259259

260+
def test_function_name_is_overriden_consistent(self):
261+
image, rie, image_name = self.tagged_name("assert_overwritten_consistent")
262+
263+
params = f"--name {image} -d --env AWS_LAMBDA_FUNCTION_NAME=MyCoolName --env AWS_LAMBDA_RIE_DYNAMIC_FUNCTION_URL=TRUE -v {self.path_to_binary}:/local-lambda-runtime-server -p {self.PORT}:8080 --entrypoint /local-lambda-runtime-server/{rie} {image_name} {DEFAULT_1P_ENTRYPOINT} main.assert_env_var_is_overwritten"
264+
265+
with self.create_container(params, image):
266+
r = self.invoke_function(function_name="MyCoolName")
267+
self.assertEqual(b'"My lambda ran succesfully"', r.content)
268+
269+
270+
def test_lambda_function_arn_exists(self):
271+
image, rie, image_name = self.tagged_name("arnexists_consistent")
272+
273+
params = f"--name {image} -d --env AWS_LAMBDA_FUNCTION_NAME=MyCoolName --env AWS_LAMBDA_RIE_DYNAMIC_FUNCTION_URL=TRUE -v {self.path_to_binary}:/local-lambda-runtime-server -p {self.PORT}:8080 --entrypoint /local-lambda-runtime-server/{rie} {image_name} {DEFAULT_1P_ENTRYPOINT} main.assert_lambda_arn_in_context"
274+
275+
with self.create_container(params, image):
276+
r = self.invoke_function(function_name="MyCoolName")
277+
self.assertEqual(b'"My lambda ran succesfully"', r.content)
278+
279+
260280
if __name__ == "__main__":
261-
main()
281+
main()

0 commit comments

Comments
 (0)