Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigation: add trace logger #1858

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 1 addition & 120 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,126 +15,6 @@ permissions:
actions: read

jobs:
apple:
if: github.repository == 'awslabs/aws-sdk-swift' || github.event_name == 'pull_request'
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
# This matrix runs tests on iOS sim & Mac, on oldest & newest supported Xcodes
runner:
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
- 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
- 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
- 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install visionOS sim if needed
if: ${{ contains(matrix.destination, 'platform=visionOS') }}
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Configure AWS Credentials for Integration Tests
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.INTEGRATION_TEST_ROLE_ARN }}
aws-region: us-west-2
- name: Checkout aws-sdk-swift
uses: actions/checkout@v4
with:
path: aws-sdk-swift
- name: Checkout smithy-swift with composite action
uses: ./aws-sdk-swift/.github/actions/checkout-smithy-swift-composite-action
with:
AUTOMATION_USER_SSH_PRIVATE_KEY: ${{ secrets.AUTOMATION_USER_SSH_PRIVATE_KEY }}
STAGING_PARTNER_REPO: ${{ secrets.STAGING_PARTNER_REPO }}
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: 2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
2-${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
2-${{ runner.os }}-gradle-
- name: Cache Swift
uses: actions/cache@v4
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/.cache/org.swift.swiftpm
key: 1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
restore-keys: |
1-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('Package.swift', 'AWSSDKSwiftCLI/Package.swift') }}
1-${{ runner.os }}-${{ matrix.xcode }}-
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Tools Versions
run: ./aws-sdk-swift/scripts/ci_steps/log_tool_versions.sh
- name: Add Credentials to Test Plan
run: |
cd aws-sdk-swift
# JSON-escape the credentials. They are also surrounded with double quotes.
AKID_ESCAPED=`echo -n "$AWS_ACCESS_KEY_ID" | jq -Rsa .`
SECRET_ESCAPED=`echo -n "$AWS_SECRET_ACCESS_KEY" | jq -Rsa .`
REGION_ESCAPED=`echo -n "$AWS_DEFAULT_REGION" | jq -Rsa .`
TOKEN_ESCAPED=`echo -n "$AWS_SESSION_TOKEN" | jq -Rsa .`
# Insert the credentials into the .xctestplan file, write the modified JSON
# to a temp file, then move the temp over the original.
jq ".defaultOptions.environmentVariableEntries += [{\"key\": \"AWS_ACCESS_KEY_ID\", \"value\": $AKID_ESCAPED}, {\"key\": \"AWS_SECRET_ACCESS_KEY\", \"value\": $SECRET_ESCAPED}, {\"key\": \"AWS_DEFAULT_REGION\", \"value\": $REGION_ESCAPED}, {\"key\": \"AWS_SESSION_TOKEN\", \"value\": $TOKEN_ESCAPED}]" IntegrationTests/XCTestPlans/AWSIntegrationTestsOnCI.xctestplan > testplan.tmp
mv testplan.tmp IntegrationTests/XCTestPlans/AWSIntegrationTestsOnCI.xctestplan
- name: Prepare Integration Tests
run: |
cd aws-sdk-swift
./scripts/ci_steps/prepare_integration_tests.sh
- name: Run Integration Tests
run: |
cd aws-sdk-swift/IntegrationTests
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
-scheme AWSIntegrationTestsOnCI \
-testPlan AWSIntegrationTestsOnCI \
-destination '${{ matrix.destination }}' \
test 2>&1 \
| xcbeautify

linux:
# Details on why AL2 isn't included: https://github.com/awslabs/aws-sdk-swift/pull/1833
if: github.repository == 'awslabs/aws-sdk-swift' || github.event_name == 'pull_request'
Expand All @@ -148,6 +28,7 @@ jobs:
version:
- "5.9"
- "6.0"
iteration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[apache-badge]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[apache-url]: LICENSE

added trace logging

## Getting Started

- [SDK Product Page](https://aws.amazon.com/sdk-for-swift/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import struct Foundation.TimeInterval
import enum AwsCommonRuntimeKit.CommonRunTimeError
import protocol SmithyRetriesAPI.RetryErrorInfoProvider
import enum ClientRuntime.DefaultRetryErrorInfoProvider
import struct Smithy.SwiftLogger
import struct SmithyRetriesAPI.RetryErrorInfo
import protocol ClientRuntime.ServiceError
import protocol ClientRuntime.HTTPError
Expand Down Expand Up @@ -55,6 +56,8 @@ public enum AWSRetryErrorInfoProvider: RetryErrorInfoProvider {
private static let timeoutStatusCodes = [408, 504]

public static func errorInfo(for error: Error) -> RetryErrorInfo? {
let logger = SwiftLogger(label: "RetryLogger")
logger.info("(RETRYING) got errorInfo for \(error)")

// Determine based on properties if this error is a timeout error.
var isTimeout = false
Expand All @@ -68,6 +71,7 @@ public enum AWSRetryErrorInfoProvider: RetryErrorInfoProvider {
// Handle certain CRT errors as transient errors
if case CommonRunTimeError.crtError(let crtError) = error {
if transientCRTErrorCodes.contains(crtError.code) {
logger.info("RETRYING CRT ERROR CODE: \(crtError.code)")
return RetryErrorInfo(errorType: .transient, retryAfterHint: nil, isTimeout: isTimeout)
}
}
Expand Down
Loading