Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skwashd committed Jul 9, 2024
1 parent ff9e4f1 commit cb1fbb7
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions test/integration/local_lambda/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def run_command(self, cmd):
def sleep_1s(self):
time.sleep(SLEEP_TIME)

def invoke_function(self, json={}, headers={}):
def invoke_function(self, json={}, headers={}, function_name="function"):
return requests.post(
f"http://localhost:{self.PORT}/2015-03-31/functions/function/invocations",
f"http://localhost:{self.PORT}/2015-03-31/functions/{function_name}/invocations",
json=json,
headers=headers,
)
Expand Down Expand Up @@ -257,5 +257,25 @@ def test_custom_client_context(self):
self.assertEqual(123, content["baz"])


def test_function_name_is_overriden_consistent(self):
image, rie, image_name = self.tagged_name("assert_overwritten_consistent")

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"

with self.create_container(params, image):
r = self.invoke_function(function_name="MyCoolName")
self.assertEqual(b'"My lambda ran succesfully"', r.content)


def test_lambda_function_arn_exists(self):
image, rie, image_name = self.tagged_name("arnexists_consistent")

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"

with self.create_container(params, image):
r = self.invoke_function(function_name="MyCoolName")
self.assertEqual(b'"My lambda ran succesfully"', r.content)


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

0 comments on commit cb1fbb7

Please sign in to comment.