Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AWS Lambda tests #3770

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix aws lambda tests (by reducing event size)
  • Loading branch information
antonpirker committed Nov 13, 2024
commit 1d291dcf4f572e88d68b8ffb8131960c6b584301
22 changes: 11 additions & 11 deletions tests/integrations/aws_lambda/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def truncate_data(data):
elif key == "cloudwatch logs":
for cloudwatch_key in data["extra"]["cloudwatch logs"].keys():
if cloudwatch_key in ["url", "log_group", "log_stream"]:
cleaned_data["extra"].setdefault("cloudwatch logs", {})[cloudwatch_key] = data["extra"]["cloudwatch logs"][cloudwatch_key]
cleaned_data["extra"].setdefault("cloudwatch logs", {})[cloudwatch_key] = data["extra"]["cloudwatch logs"][cloudwatch_key].split("=")[0]

if data.get("level") is not None:
cleaned_data["level"] = data.get("level")
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_handler(event, context):
assert event["extra"]["lambda"]["function_name"].startswith("test_")

logs_url = event["extra"]["cloudwatch logs"]["url"]
assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region")
assert not re.search("(=;|=$)", logs_url)
assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
"/aws/lambda/test_"
Expand Down Expand Up @@ -370,7 +370,7 @@ def test_handler(event, context):
assert event["extra"]["lambda"]["function_name"].startswith("test_")

logs_url = event["extra"]["cloudwatch logs"]["url"]
assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region")
assert not re.search("(=;|=$)", logs_url)
assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
"/aws/lambda/test_"
Expand Down Expand Up @@ -462,23 +462,23 @@ def test_handler(event, context):
"X-Forwarded-Proto": "https"
},
"httpMethod": "GET",
"path": "/path1",
"path": "/1",
"queryStringParameters": {
"done": "false"
"done": "f"
},
"dog": "Maisey"
"d": "D1"
},
{
"headers": {
"Host": "x2.io",
"X-Forwarded-Proto": "http"
},
"httpMethod": "POST",
"path": "/path2",
"path": "/2",
"queryStringParameters": {
"done": "true"
"done": "t"
},
"dog": "Charlie"
"d": "D2"
}
]
""",
Expand Down Expand Up @@ -538,9 +538,9 @@ def test_handler(event, context):
request_data = {
"headers": {"Host": "x1.io", "X-Forwarded-Proto": "https"},
"method": "GET",
"url": "https://x1.io/path1",
"url": "https://x1.io/1",
"query_string": {
"done": "false",
"done": "f",
},
}
else:
Expand Down
Loading