Skip to content

Commit ed795aa

Browse files
authored
CSHARP-5479: Fix AWS lambda tests (#1606)
1 parent e3f3943 commit ed795aa

File tree

4 files changed

+15
-37
lines changed

4 files changed

+15
-37
lines changed

evergreen/evergreen.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,9 @@ tasks:
15211521
params:
15221522
role_arn: ${LAMBDA_AWS_ROLE_ARN}
15231523
duration_seconds: 3600
1524+
- func: install-dotnet
1525+
vars:
1526+
DOTNET_SDK_VERSION: 8.0
15241527
- command: shell.exec
15251528
params:
15261529
working_dir: mongo-csharp-driver
@@ -1529,6 +1532,7 @@ tasks:
15291532
${PREPARE_SHELL}
15301533
evergreen/run-deployed-lambda-aws-tests.sh
15311534
env:
1535+
LAMBDA_STACK_NAME: dbx-csharp-lambda
15321536
TEST_LAMBDA_DIRECTORY: ${PROJECT_DIRECTORY}/tests/FaasTests/LambdaTests
15331537
AWS_REGION: us-east-1
15341538

@@ -2067,8 +2071,6 @@ task_groups:
20672071
- "AWS_ACCESS_KEY_ID"
20682072
- "AWS_SECRET_ACCESS_KEY"
20692073
- "AWS_SESSION_TOKEN"
2070-
env:
2071-
VAULT_NAME: "azurekms"
20722074
args:
20732075
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/setup-secrets.sh
20742076
- command: subprocess.exec
@@ -2115,8 +2117,6 @@ task_groups:
21152117
- "AWS_ACCESS_KEY_ID"
21162118
- "AWS_SECRET_ACCESS_KEY"
21172119
- "AWS_SESSION_TOKEN"
2118-
env:
2119-
VAULT_NAME: "gcpkms"
21202120
args:
21212121
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/setup-secrets.sh
21222122
- command: subprocess.exec
@@ -2161,10 +2161,9 @@ task_groups:
21612161
- "AWS_ACCESS_KEY_ID"
21622162
- "AWS_SECRET_ACCESS_KEY"
21632163
- "AWS_SESSION_TOKEN"
2164-
env:
2165-
VAULT_NAME: "atlas"
21662164
args:
21672165
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-secrets.sh
2166+
- "atlas"
21682167
- command: subprocess.exec
21692168
params:
21702169
binary: bash
@@ -2196,17 +2195,18 @@ task_groups:
21962195
- command: subprocess.exec
21972196
params:
21982197
binary: bash
2199-
add_expansions_to_env: true
2198+
env:
2199+
LAMBDA_STACK_NAME: dbx-csharp-lambda
22002200
args:
22012201
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
22022202
- command: expansions.update
22032203
params:
22042204
file: atlas-expansion.yml
2205+
redact_file_expansions: true
22052206
teardown_group:
22062207
- command: subprocess.exec
22072208
params:
22082209
binary: bash
2209-
add_expansions_to_env: true
22102210
args:
22112211
- ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh
22122212
tasks:

evergreen/run-deployed-lambda-aws-tests.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,10 @@
33
set -o xtrace # Write all commands first to stderr
44
set -o errexit # Exit the script with error if any of the commands fail
55

6-
LOCALTOOLPATH=$TEST_LAMBDA_DIRECTORY/localtool
6+
# SAM CLI installs the "Amazon.Lambda.Tools" tool in this location so we need to add it to our PATH
7+
export PATH="$PATH:$HOME/.dotnet/tools"
78

8-
echo "Installing aws lambda tool to a custom location"
9-
dotnet tool install "Amazon.Lambda.Tools" --tool-path $LOCALTOOLPATH
9+
# setting this as SAM CLI seems to check DOTNET_ROOT directly instead of the PATH
10+
export DOTNET_ROOT=$DOTNET_SDK_PATH
1011

11-
# makes the "sam build" command use the local version of the lambda tool
12-
export PATH="$PATH:$LOCALTOOLPATH"
13-
14-
. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh
15-
16-
# uninstall global version installed by the "sam build" command
17-
dotnet tool uninstall -g "Amazon.Lambda.Tools"
18-
19-
# uninstall our local version
20-
dotnet tool uninstall "Amazon.Lambda.Tools" --tool-path $LOCALTOOLPATH
12+
. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh

tests/FaasTests/LambdaTests/MongoDB.Driver.LambdaTest/MongoDB.Driver.LambdaTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
66
<AWSProjectType>Lambda</AWSProjectType>
77
<IsPackable>false</IsPackable>

tests/FaasTests/LambdaTests/template.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Resources:
2121
Properties:
2222
CodeUri: MongoDB.Driver.LambdaTest/
2323
Handler: MongoDB.Driver.LambdaTest::MongoDB.Driver.LambdaTest.LambdaFunction::LambdaFunctionHandlerAsync
24-
Runtime: dotnet6
24+
Runtime: dotnet8
2525
Architectures:
2626
- x86_64
2727
Environment:
@@ -33,20 +33,6 @@ Resources:
3333
Properties:
3434
Path: /mongodb
3535
Method: get
36-
37-
ApplicationResourceGroup:
38-
Type: AWS::ResourceGroups::Group
39-
Properties:
40-
Name:
41-
Fn::Sub: ApplicationInsights-SAM-${AWS::StackName}
42-
ResourceQuery:
43-
Type: CLOUDFORMATION_STACK_1_0
44-
ApplicationInsightsMonitoring:
45-
Type: AWS::ApplicationInsights::Application
46-
Properties:
47-
ResourceGroupName:
48-
Ref: ApplicationResourceGroup
49-
AutoConfigurationEnabled: 'true'
5036
Outputs:
5137
LambdaTestApi:
5238
Description: API Gateway endpoint URL for Prod stage for C# Driver Lambda Test function

0 commit comments

Comments
 (0)