Skip to content

Commit cd6feb9

Browse files
authored
Filtering Integration tests with SERVICE_ID and build type
1 parent 51a8c61 commit cd6feb9

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

tools/scripts/build-tests/run-al2-integ-tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ AWS_ROLE_SESSION_NAME="$3"
2121

2222
echo "Setting the run environment"
2323
export TEST_ASSUME_ROLE_ARN=arn:aws:iam::${AWS_ACCOUNT}:role/IntegrationTest
24+
BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d '"')
25+
echo "BUILD_TYPE=${BUILD_TYPE}"
26+
pushd ${PREFIX_DIR}/aws-sdk-cpp
27+
if [ "${BUILD_TYPE}" = "PREVIEW" ]; then SERVICE_ID=$(git status generated/src/aws-cpp-sdk-* --porcelain | grep "generated/src/" | sed -n 's|.*generated/src/aws-cpp-sdk-\([^/]*\).*|\1|p' | sort -u | tr "\n" "," | sed "s/,$//"); else SERVICE_ID=""; fi
28+
popd
29+
echo "SERVICE_ID=${SERVICE_ID}"
2430
export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources
2531
export sts=$(aws sts assume-role --role-arn "$TEST_ASSUME_ROLE_ARN" --role-session-name "${AWS_ROLE_SESSION_NAME}" --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]')
2632
export profile=sdk-integ-test
@@ -32,4 +38,4 @@ export AWS_PROFILE=$profile
3238
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/:${PREFIX_DIR}/al2-build/tests/testing-resources/"
3339
cd "${PREFIX_DIR}/al2-build"
3440
if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi
35-
python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests
41+
python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests --serviceId ${SERVICE_ID:-""}

tools/scripts/build-tests/run-mac-integ-tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ AWS_ROLE_SESSION_NAME="$3"
2121

2222
echo "Setting the run environment"
2323
export TEST_ASSUME_ROLE_ARN=arn:aws:iam::${AWS_ACCOUNT}:role/IntegrationTest
24+
BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d '"')
25+
echo "Build type: ${BUILD_TYPE}"
26+
pushd ${PREFIX_DIR}/aws-sdk-cpp
27+
if [ "${BUILD_TYPE}" = "PREVIEW" ]; then SERVICE_ID=$(git status generated/src/aws-cpp-sdk-* --porcelain | grep "generated/src/" | sed -n 's|.*generated/src/aws-cpp-sdk-\([^/]*\).*|\1|p' | sort -u | tr "\n" "," | sed "s/,$//"); else SERVICE_ID=""; fi
28+
popd
29+
echo "Service ID: ${SERVICE_ID}"
2430
export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources
2531
export sts=$(aws sts assume-role --role-arn "$TEST_ASSUME_ROLE_ARN" --role-session-name "${AWS_ROLE_SESSION_NAME}" --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]')
2632
export profile=sdk-integ-test
@@ -32,4 +38,4 @@ export AWS_PROFILE=$profile
3238
export DYLD_LIBRARY_PATH="${CATAPULT_WORKSPACE_DIR}/mac-install/lib:${CATAPULT_WORKSPACE_DIR}/mac-build/tests/testing-resources/"
3339
cd "${PREFIX_DIR}/mac-build"
3440
if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi
35-
python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests
41+
python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests --serviceId ${SERVICE_ID:-""}

tools/scripts/build-tests/run-windows-integ-tests.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ aws configure set aws_access_key_id (${sts}[1] -replace " " -replace "`"" -repla
1717
aws configure set aws_secret_access_key (${sts}[2] -replace " " -replace "`"" -replace ",")
1818
aws configure set aws_session_token (${sts}[3] -replace " " -replace "`"" -replace ",")
1919
aws configure list
20+
$BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d \\)
21+
Write-Host BUILD_TYPE:$BUILD_TYPE
22+
Push-Location "${env:CATAPULT_WORKSPACE_DIR}\\aws-sdk-cpp"
23+
if ($BUILD_TYPE -eq "PREVIEW") { $SERVICE_ID = (git status generated/src/aws-cpp-sdk-* --porcelain | Select-String "generated/src/" | ForEach-Object { if($_ -match "generated/src/aws-cpp-sdk-([^/]*)") { $matches[1] } } | Sort-Object -Unique) -join "," } else { $SERVICE_ID="" }
24+
Write-Host "SERVICE_ID: $SERVICE_ID"
25+
Pop-Location
2026
# Run tests
2127
cd "${env:PREFIX_DIR}\\win-build"
22-
python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug
28+
if ($SERVICE_ID) { & python ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug --serviceId $SERVICE_ID } else { & python ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug }

tools/scripts/run_integration_tests.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ def parse_arguments():
1717

1818
parser = argparse.ArgumentParser(description="AWSNativeSDK Run all Integration Tests")
1919
parser.add_argument("--testDir", action="store")
20+
parser.add_argument("--serviceId", action="store")
2021

2122
args = vars(parser.parse_args())
2223
arg_map["testDir"] = args["testDir"] or "./build"
24+
arg_map["serviceId"] = args["serviceId"] or ""
2325

2426
return arg_map
2527

@@ -35,7 +37,7 @@ def main():
3537
test_has_parent_dir = platform.system() != "Windows"
3638
exe_extension = ".exe" if platform.system() == "Windows" else ""
3739

38-
test_list = [
40+
all_tests = [
3941
"aws-cpp-sdk-core-integration-tests",
4042
"aws-cpp-sdk-transcribestreaming-integ-tests",
4143
"aws-cpp-sdk-dynamodb-unit-tests",
@@ -59,6 +61,21 @@ def main():
5961
"aws-cpp-sdk-bedrock-runtime-integration-tests"
6062
]
6163

64+
if arguments["serviceId"]:
65+
service_ids = arguments["serviceId"].split(",")
66+
test_list = []
67+
for test in all_tests:
68+
service = test.replace('aws-cpp-sdk-', '').replace('-integration-tests', '').replace('-unit-tests', '').replace('-tests', '')
69+
if service != "core":
70+
for service_id in service_ids:
71+
if service_id == service:
72+
test_list.append(test)
73+
break
74+
else:
75+
test_list.append(test)
76+
else:
77+
test_list = all_tests.copy()
78+
6279
# check for existence of these binaries before adding them to tests
6380
# as they will not always be present
6481
cmake_dependent_tests = [

0 commit comments

Comments
 (0)