From 3d2965903f52acae7b23cabec0feb7d7d26746fe Mon Sep 17 00:00:00 2001 From: adelinowona Date: Wed, 29 Jan 2025 12:29:32 -0500 Subject: [PATCH 1/3] CSHARP-5479: Fix aws lambda tests --- evergreen/evergreen.yml | 9 +++++++-- evergreen/run-deployed-lambda-aws-tests.sh | 18 +++++------------- .../MongoDB.Driver.LambdaTest.csproj | 2 +- tests/FaasTests/LambdaTests/template.yaml | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 0fd3cbfa4fa..2e85919ccdd 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -1521,6 +1521,9 @@ tasks: params: role_arn: ${LAMBDA_AWS_ROLE_ARN} duration_seconds: 3600 + - func: install-dotnet + vars: + DOTNET_SDK_VERSION: 8.0 - command: shell.exec params: working_dir: mongo-csharp-driver @@ -1529,6 +1532,7 @@ tasks: ${PREPARE_SHELL} evergreen/run-deployed-lambda-aws-tests.sh env: + LAMBDA_STACK_NAME: dbx-csharp-lambda TEST_LAMBDA_DIRECTORY: ${PROJECT_DIRECTORY}/tests/FaasTests/LambdaTests AWS_REGION: us-east-1 @@ -2196,17 +2200,18 @@ task_groups: - command: subprocess.exec params: binary: bash - add_expansions_to_env: true + env: + LAMBDA_STACK_NAME: dbx-csharp-lambda args: - ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh - command: expansions.update params: file: atlas-expansion.yml + redact_file_expansions: true teardown_group: - command: subprocess.exec params: binary: bash - add_expansions_to_env: true args: - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh tasks: diff --git a/evergreen/run-deployed-lambda-aws-tests.sh b/evergreen/run-deployed-lambda-aws-tests.sh index 70774969c0d..5a573dbc5eb 100755 --- a/evergreen/run-deployed-lambda-aws-tests.sh +++ b/evergreen/run-deployed-lambda-aws-tests.sh @@ -3,18 +3,10 @@ set -o xtrace # Write all commands first to stderr set -o errexit # Exit the script with error if any of the commands fail -LOCALTOOLPATH=$TEST_LAMBDA_DIRECTORY/localtool +# SAM CLI installs the "Amazon.Lambda.Tools" tool in this location so we need to add it to our PATH +export PATH="$PATH:$HOME/.dotnet/tools" -echo "Installing aws lambda tool to a custom location" -dotnet tool install "Amazon.Lambda.Tools" --tool-path $LOCALTOOLPATH +# setting this as SAM CLI seems to check DOTNET_ROOT directly instead of the PATH +export DOTNET_ROOT=$DOTNET_SDK_PATH -# makes the "sam build" command use the local version of the lambda tool -export PATH="$PATH:$LOCALTOOLPATH" - -. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh - -# uninstall global version installed by the "sam build" command -dotnet tool uninstall -g "Amazon.Lambda.Tools" - -# uninstall our local version -dotnet tool uninstall "Amazon.Lambda.Tools" --tool-path $LOCALTOOLPATH +. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh \ No newline at end of file diff --git a/tests/FaasTests/LambdaTests/MongoDB.Driver.LambdaTest/MongoDB.Driver.LambdaTest.csproj b/tests/FaasTests/LambdaTests/MongoDB.Driver.LambdaTest/MongoDB.Driver.LambdaTest.csproj index 688b6b06276..7a9335bf0d2 100644 --- a/tests/FaasTests/LambdaTests/MongoDB.Driver.LambdaTest/MongoDB.Driver.LambdaTest.csproj +++ b/tests/FaasTests/LambdaTests/MongoDB.Driver.LambdaTest/MongoDB.Driver.LambdaTest.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 true Lambda false diff --git a/tests/FaasTests/LambdaTests/template.yaml b/tests/FaasTests/LambdaTests/template.yaml index 2982e94c321..4b51bcab6c3 100644 --- a/tests/FaasTests/LambdaTests/template.yaml +++ b/tests/FaasTests/LambdaTests/template.yaml @@ -21,7 +21,7 @@ Resources: Properties: CodeUri: MongoDB.Driver.LambdaTest/ Handler: MongoDB.Driver.LambdaTest::MongoDB.Driver.LambdaTest.LambdaFunction::LambdaFunctionHandlerAsync - Runtime: dotnet6 + Runtime: dotnet8 Architectures: - x86_64 Environment: From fd1a4daf0e69ef813dd5fffc4455ad91dc0328a6 Mon Sep 17 00:00:00 2001 From: adelinowona Date: Fri, 31 Jan 2025 10:51:51 -0500 Subject: [PATCH 2/3] some evergreen cleanup --- evergreen/evergreen.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 2e85919ccdd..b4bcf6f7d08 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -2071,8 +2071,6 @@ task_groups: - "AWS_ACCESS_KEY_ID" - "AWS_SECRET_ACCESS_KEY" - "AWS_SESSION_TOKEN" - env: - VAULT_NAME: "azurekms" args: - ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/setup-secrets.sh - command: subprocess.exec @@ -2119,8 +2117,6 @@ task_groups: - "AWS_ACCESS_KEY_ID" - "AWS_SECRET_ACCESS_KEY" - "AWS_SESSION_TOKEN" - env: - VAULT_NAME: "gcpkms" args: - ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/setup-secrets.sh - command: subprocess.exec @@ -2165,10 +2161,9 @@ task_groups: - "AWS_ACCESS_KEY_ID" - "AWS_SECRET_ACCESS_KEY" - "AWS_SESSION_TOKEN" - env: - VAULT_NAME: "atlas" args: - ${DRIVERS_TOOLS}/.evergreen/atlas/setup-secrets.sh + - "atlas" - command: subprocess.exec params: binary: bash From 91a58412851f05fdce51091e4e2bb1f5f39befb6 Mon Sep 17 00:00:00 2001 From: adelinowona Date: Mon, 3 Feb 2025 12:59:38 -0500 Subject: [PATCH 3/3] remove application insights monitoring --- tests/FaasTests/LambdaTests/template.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/FaasTests/LambdaTests/template.yaml b/tests/FaasTests/LambdaTests/template.yaml index 4b51bcab6c3..a01262a471d 100644 --- a/tests/FaasTests/LambdaTests/template.yaml +++ b/tests/FaasTests/LambdaTests/template.yaml @@ -33,20 +33,6 @@ Resources: Properties: Path: /mongodb Method: get - - ApplicationResourceGroup: - Type: AWS::ResourceGroups::Group - Properties: - Name: - Fn::Sub: ApplicationInsights-SAM-${AWS::StackName} - ResourceQuery: - Type: CLOUDFORMATION_STACK_1_0 - ApplicationInsightsMonitoring: - Type: AWS::ApplicationInsights::Application - Properties: - ResourceGroupName: - Ref: ApplicationResourceGroup - AutoConfigurationEnabled: 'true' Outputs: LambdaTestApi: Description: API Gateway endpoint URL for Prod stage for C# Driver Lambda Test function