From fcc65e652d2d987729c1eacd9e6e10b5716ab36d Mon Sep 17 00:00:00 2001 From: sbiscigl Date: Fri, 13 Jun 2025 16:45:51 -0400 Subject: [PATCH] fix, and enable lambda integration tests --- .../FunctionTest.cpp | 10 ++++------ tools/scripts/build-tests/run-al2-integ-tests.sh | 2 +- tools/scripts/run_integration_tests.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp b/tests/aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp index f78a2aeec0c..696fac307e8 100644 --- a/tests/aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp +++ b/tests/aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -247,14 +246,14 @@ class FunctionTest : public ::testing::Test { functionCode.SetZipFile(Aws::Utils::ByteBuffer((unsigned char*)buffer.str().c_str(), buffer.str().length())); createFunctionRequest.SetCode(functionCode); - createFunctionRequest.SetRuntime(Aws::Lambda::Model::Runtime::nodejs12_x); + createFunctionRequest.SetRuntime(Aws::Lambda::Model::Runtime::nodejs22_x); CreateFunctionOutcome createFunctionOutcome = m_client->CreateFunction(createFunctionRequest); AWS_ASSERT_SUCCESS(createFunctionOutcome); ASSERT_EQ(functionName,createFunctionOutcome.GetResult().GetFunctionName()); ASSERT_EQ("test.handler",createFunctionOutcome.GetResult().GetHandler()); ASSERT_EQ(roleARN,createFunctionOutcome.GetResult().GetRole()); - ASSERT_EQ(Aws::Lambda::Model::Runtime::nodejs12_x, createFunctionOutcome.GetResult().GetRuntime()); + ASSERT_EQ(Aws::Lambda::Model::Runtime::nodejs22_x, createFunctionOutcome.GetResult().GetRuntime()); functionArnMapping[functionName] = createFunctionOutcome.GetResult().GetFunctionArn(); WaitForFunctionStatus(functionName, Aws::Lambda::Model::State::Active); @@ -316,7 +315,7 @@ TEST_F(FunctionTest, TestGetFunction) AWS_EXPECT_SUCCESS(getFunctionOutcome); GetFunctionResult getFunctionResult = getFunctionOutcome.GetResult(); - EXPECT_EQ(Runtime::nodejs12_x, getFunctionResult.GetConfiguration().GetRuntime()); + EXPECT_EQ(Runtime::nodejs22_x, getFunctionResult.GetConfiguration().GetRuntime()); EXPECT_EQ("test.handler",getFunctionResult.GetConfiguration().GetHandler()); EXPECT_EQ(simpleFunctionName,getFunctionResult.GetConfiguration().GetFunctionName()); //Just see that is looks like an aws url @@ -334,7 +333,7 @@ TEST_F(FunctionTest, TestGetFunctionConfiguration) AWS_EXPECT_SUCCESS(getFunctionConfigurationOutcome); GetFunctionConfigurationResult getFunctionConfigurationResult = getFunctionConfigurationOutcome.GetResult(); - EXPECT_EQ(Runtime::nodejs12_x, getFunctionConfigurationResult.GetRuntime()); + EXPECT_EQ(Runtime::nodejs22_x, getFunctionConfigurationResult.GetRuntime()); EXPECT_EQ("test.handler",getFunctionConfigurationResult.GetHandler()); EXPECT_EQ(simpleFunctionName,getFunctionConfigurationResult.GetFunctionName()); } @@ -490,7 +489,6 @@ TEST_F(FunctionTest, TestPermissions) if (!getRemovedPolicyOutcome.IsSuccess()) { EXPECT_EQ(LambdaErrors::RESOURCE_NOT_FOUND, getRemovedPolicyOutcome.GetError().GetErrorType()); - EXPECT_STREQ("User", getRemovedPolicyOutcome.GetError().GetType().c_str()); } //Now we should get an empty policy a GetPolicy because we just removed it else diff --git a/tools/scripts/build-tests/run-al2-integ-tests.sh b/tools/scripts/build-tests/run-al2-integ-tests.sh index 153e87feb45..ac8ee3af18a 100755 --- a/tools/scripts/build-tests/run-al2-integ-tests.sh +++ b/tools/scripts/build-tests/run-al2-integ-tests.sh @@ -21,7 +21,7 @@ AWS_ROLE_SESSION_NAME="$3" echo "Setting the run environment" export TEST_ASSUME_ROLE_ARN=arn:aws:iam::${AWS_ACCOUNT}:role/IntegrationTest -export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tools/aws-cpp-sdk-lambda-integration-tests/resources +export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources export sts=$(aws sts assume-role --role-arn "$TEST_ASSUME_ROLE_ARN" --role-session-name "${AWS_ROLE_SESSION_NAME}" --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]') export profile=sdk-integ-test aws configure set aws_access_key_id $(echo "$sts" | jq -r '.[0]') --profile "$profile" diff --git a/tools/scripts/run_integration_tests.py b/tools/scripts/run_integration_tests.py index ae0c7b4a98c..ffd5a4276fe 100644 --- a/tools/scripts/run_integration_tests.py +++ b/tools/scripts/run_integration_tests.py @@ -45,7 +45,7 @@ def main(): "aws-cpp-sdk-s3-unit-tests", "aws-cpp-sdk-s3-crt-integration-tests", #"aws-cpp-sdk-s3control-integration-tests", - # "aws-cpp-sdk-lambda-integration-tests", + "aws-cpp-sdk-lambda-integration-tests", "aws-cpp-sdk-cognitoidentity-integration-tests", #"aws-cpp-sdk-transfer-tests", #"aws-cpp-sdk-s3-encryption-integration-tests",