Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/pip/requirements/develop/pydan…
Browse files Browse the repository at this point in the history
…tic-core-2.14.6
  • Loading branch information
mildaniel authored Jan 3, 2024
2 parents 2ba2baa + b5503ae commit f6be29e
Show file tree
Hide file tree
Showing 19 changed files with 465 additions and 387 deletions.
4 changes: 4 additions & 0 deletions appveyor-linux-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ install:
- sh: "PATH=/opt/gradle/gradle-8.4/bin:$PATH"
- sh: "gradle --version"

# Install dotnet8 SDK
- sh: "sudo apt-get update"
- sh: "sudo apt-get install -y dotnet-sdk-8.0"

# Install AWS CLI
- sh: "virtualenv aws_cli"
- sh: "./aws_cli/bin/python -m pip install awscli"
Expand Down
4 changes: 4 additions & 0 deletions appveyor-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ install:
- sh: "PATH=/opt/gradle/gradle-8.4/bin:$PATH"
- sh: "gradle --version"

# Install dotnet8 SDK
- sh: "sudo apt-get update"
- sh: "sudo apt-get install -y dotnet-sdk-8.0"

# Install AWS CLI
- sh: "virtualenv aws_cli"
- sh: "./aws_cli/bin/python -m pip install awscli"
Expand Down
6 changes: 3 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
chevron~=0.12
click~=8.1
Flask<3.1
boto3>=1.26.109,<2
boto3>=1.29.2,<2
jmespath~=1.0.1
ruamel_yaml~=0.18.5
PyYAML~=6.0,>=6.0.1
Expand All @@ -11,7 +11,7 @@ aws-sam-translator==1.82.0
docker~=6.1.0
dateparser~=1.2
requests~=2.31.0
aws_lambda_builders==1.44.0
aws_lambda_builders==1.45.0
tomlkit==0.12.3
watchdog==3.0.0
rich~=13.7.0
Expand All @@ -31,4 +31,4 @@ tzlocal==5.2
cfn-lint~=0.83.5

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.4
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.34.9
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r pre-dev.txt

coverage==7.3.3
coverage==7.4.0
pytest-cov==4.1.0


Expand Down
248 changes: 124 additions & 124 deletions requirements/reproducible-linux.txt

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions requirements/reproducible-mac.txt

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions requirements/reproducible-win.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
SAM CLI version
"""

__version__ = "1.105.0"
__version__ = "1.106.0"
4 changes: 3 additions & 1 deletion samcli/lib/observability/cw_logs/cw_log_group_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def for_lambda_function(boto_client_provider: BotoProviderType, function_name: s
"""
log_group_name = ""
try:
function_configuration = boto_client_provider("lambda").get_function_configuration(function_name)
function_configuration = boto_client_provider("lambda").get_function_configuration(
FunctionName=function_name
)
logging_config = function_configuration.get("LoggingConfig")
if logging_config:
log_group_name = logging_config.get("LogGroup")
Expand Down
1 change: 1 addition & 0 deletions tests/integration/logs/test_logs_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def _check_logs(self, cmd_list: List, log_strings: List[str], output: str = "tex
REGULAR_STACK_FUNCTION_LIST = [
"ApiGwFunction",
"SfnFunction",
"FunctionWithCustomLoggingConfig",
]
REGULAR_STACK_APIGW_LIST = [
"HelloWorldServerlessApi",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def handler(event, context):
print("Hello world from ChildStack/FunctionWithCustomLoggingConfig function")
print("this should be filtered ChildStackFunctionWithCustomLoggingConfig")
return {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def handler(event, context):
print("Hello world from ChildStack/GrandChildStack/FunctionWithCustomLoggingConfig function")
print("this should be filtered ChildStackGrandChildStackFunctionWithCustomLoggingConfig")
return {}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
Properties:
CodeUri: apigw-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active
Events:
HelloWorld:
Expand All @@ -81,7 +81,7 @@ Resources:
Properties:
CodeUri: sfn-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active

HelloWorldServerlessApi:
Expand Down Expand Up @@ -113,6 +113,17 @@ Resources:
ManagedPolicyArns:
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"

FunctionWithCustomLoggingConfig:
Type: AWS::Serverless::Function
Properties:
CodeUri: function-with-custom-logging/
Handler: app.handler
Runtime: python3.12
Tracing: Active
LoggingConfig:
LogFormat: JSON
LogGroup: !Sub /aws/lambda/${AWS::StackName}

Outputs:
HelloWorldServerlessApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
Properties:
CodeUri: apigw-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active
Events:
HelloWorld:
Expand All @@ -81,7 +81,7 @@ Resources:
Properties:
CodeUri: sfn-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active

HelloWorldServerlessApi:
Expand Down Expand Up @@ -113,6 +113,17 @@ Resources:
ManagedPolicyArns:
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"

FunctionWithCustomLoggingConfig:
Type: AWS::Serverless::Function
Properties:
CodeUri: function-with-custom-logging/
Handler: app.handler
Runtime: python3.12
Tracing: Active
LoggingConfig:
LogFormat: JSON
LogGroup: !Sub /aws/lambda/${AWS::StackName}

GrandChildStack:
Type: AWS::Serverless::Application
Properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def handler(event, context):
print("Hello world from FunctionWithCustomLoggingConfig function")
print("this should be filtered FunctionWithCustomLoggingConfig")
return {}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
Properties:
CodeUri: apigw-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active
Events:
HelloWorld:
Expand All @@ -81,7 +81,7 @@ Resources:
Properties:
CodeUri: sfn-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active

HelloWorldServerlessApi:
Expand Down Expand Up @@ -113,6 +113,17 @@ Resources:
ManagedPolicyArns:
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"

FunctionWithCustomLoggingConfig:
Type: AWS::Serverless::Function
Properties:
CodeUri: function-with-custom-logging/
Handler: app.handler
Runtime: python3.12
Tracing: Active
LoggingConfig:
LogFormat: JSON
LogGroup: !Sub /aws/lambda/${AWS::StackName}

ChildStack:
Type: AWS::Serverless::Application
Properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def handler(event, context):
print("Hello world from FunctionWithCustomLoggingConfig function")
print("this should be filtered FunctionWithCustomLoggingConfig")
return {}
15 changes: 13 additions & 2 deletions tests/integration/testdata/logs/python-apigw-sfn/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
Properties:
CodeUri: apigw-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active
Events:
HelloWorld:
Expand All @@ -81,7 +81,7 @@ Resources:
Properties:
CodeUri: sfn-function/
Handler: app.handler
Runtime: python3.9
Runtime: python3.12
Tracing: Active

HelloWorldServerlessApi:
Expand Down Expand Up @@ -113,6 +113,17 @@ Resources:
ManagedPolicyArns:
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"

FunctionWithCustomLoggingConfig:
Type: AWS::Serverless::Function
Properties:
CodeUri: function-with-custom-logging/
Handler: app.handler
Runtime: python3.12
Tracing: Active
LoggingConfig:
LogFormat: JSON
LogGroup: !Sub /aws/lambda/${AWS::StackName}

Outputs:
HelloWorldServerlessApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from unittest import TestCase
from unittest.mock import Mock, ANY
from unittest.mock import Mock, ANY, call

from parameterized import parameterized

Expand All @@ -26,6 +26,9 @@ def test_must_return_custom_log_group_name(self):
result = LogGroupProvider.for_lambda_function(given_client_provider, "my_function_name")

self.assertEqual(expected, result)
given_client_provider.assert_has_calls(
[call("lambda").get_function_configuration(FunctionName="my_function_name")]
)

def test_must_return_default_log_group_name_with_exception_raised(self):
expected = "/aws/lambda/my_function_name"
Expand Down

0 comments on commit f6be29e

Please sign in to comment.