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

chore: Add & re-enable concurrency tests #1815

Closed
wants to merge 122 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
c92d539
WIP
jbelkins Aug 31, 2024
5235418
Merge branch 'main' into jbe/wtf_bridge
jbelkins Sep 3, 2024
0f27f16
Merge branch 'main' into jbe/wtf_bridge
jbelkins Sep 10, 2024
eada965
Merge branch 'main' into jbe/wtf_bridge
jbelkins Sep 12, 2024
bbe76e7
Merge branch 'main' into jbe/wtf_bridge
jbelkins Sep 18, 2024
613176a
Merge remote-tracking branch 'origin/main' into jbe/wtf_bridge
jbelkins Sep 20, 2024
d361254
Update API model
aws-sdk-swift-automation Sep 20, 2024
ae2f37a
chore: Updates version to 1.0.3
aws-sdk-swift-automation Sep 20, 2024
5dab112
feat: Add concurrent integration test & utils (#1596)
sichanyoo Sep 23, 2024
7d741fc
Update API model
aws-sdk-swift-automation Sep 23, 2024
298b2a1
chore: Updates version to 1.0.4
aws-sdk-swift-automation Sep 23, 2024
17a8a3c
chore: Install visionOS 2.0 sim when needed (#1772)
jbelkins Sep 23, 2024
1ec7b28
Update API model
aws-sdk-swift-automation Sep 24, 2024
b31d1bf
Update endpoints model
aws-sdk-swift-automation Sep 24, 2024
3a2053e
chore: Updates version to 1.0.5
aws-sdk-swift-automation Sep 24, 2024
1eb2d18
feat: Make models Sendable (#1771)
jbelkins Sep 24, 2024
d07c016
fix: Make manifest Swift 6 Language Mode compatible (#1774)
jbelkins Sep 24, 2024
8dc28f4
chore: Remove Dockerfiles (#1777)
jbelkins Sep 25, 2024
bce6624
Update API model
aws-sdk-swift-automation Sep 25, 2024
0d6d00e
Update endpoints model
aws-sdk-swift-automation Sep 25, 2024
a15d3fa
chore: Updates version to 1.0.6
aws-sdk-swift-automation Sep 25, 2024
0087fbe
Update API model
aws-sdk-swift-automation Sep 26, 2024
81244ca
Update endpoints model
aws-sdk-swift-automation Sep 26, 2024
606619a
chore: Updates version to 1.0.7
aws-sdk-swift-automation Sep 26, 2024
8ccbac3
feat: Add token resolution to ECS credential provider (#1778)
dayaffe Sep 26, 2024
c84f67d
chore: Scale concurrent integration tests from 100x to 20x (#1779)
jbelkins Sep 26, 2024
4378e0f
Update API model
aws-sdk-swift-automation Sep 27, 2024
864a584
Update endpoints model
aws-sdk-swift-automation Sep 27, 2024
f06eb68
chore: Updates version to 1.0.8
aws-sdk-swift-automation Sep 27, 2024
5592ec4
Update API model
aws-sdk-swift-automation Sep 30, 2024
6c175c2
chore: Updates version to 1.0.9
aws-sdk-swift-automation Sep 30, 2024
05b9862
Update API model
aws-sdk-swift-automation Oct 1, 2024
18501ab
Update endpoints model
aws-sdk-swift-automation Oct 1, 2024
9a8b696
chore: Updates version to 1.0.10
aws-sdk-swift-automation Oct 1, 2024
edebe10
Update API model
aws-sdk-swift-automation Oct 2, 2024
278e231
Update endpoints model
aws-sdk-swift-automation Oct 2, 2024
2139d33
chore: Updates version to 1.0.11
aws-sdk-swift-automation Oct 2, 2024
36ae34c
Update API model
aws-sdk-swift-automation Oct 3, 2024
074b210
Update endpoints model
aws-sdk-swift-automation Oct 3, 2024
b71c7b6
chore: Updates version to 1.0.12
aws-sdk-swift-automation Oct 3, 2024
c91195c
Update API model
aws-sdk-swift-automation Oct 4, 2024
9b3c5c6
Update endpoints model
aws-sdk-swift-automation Oct 4, 2024
c6ea89e
chore: Updates version to 1.0.13
aws-sdk-swift-automation Oct 4, 2024
bf7f00a
feat: Service client release notes (#1780)
sichanyoo Oct 4, 2024
9e675f1
Revert "feat: Service client release notes (#1780)" (#1782)
sichanyoo Oct 4, 2024
a2ea91c
Update API model
aws-sdk-swift-automation Oct 7, 2024
1fd5d15
Update endpoints model
aws-sdk-swift-automation Oct 7, 2024
370e3ac
chore: Updates version to 1.0.14
aws-sdk-swift-automation Oct 7, 2024
0ea9a90
Update API model
aws-sdk-swift-automation Oct 8, 2024
17e8577
Update endpoints model
aws-sdk-swift-automation Oct 8, 2024
77fa9d3
chore: Updates version to 1.0.15
aws-sdk-swift-automation Oct 8, 2024
989cd0c
feat: Service client release notes (#1783)
sichanyoo Oct 8, 2024
90ab3a8
chore: Protocol tests set their own AWS credentials (#1784)
jbelkins Oct 9, 2024
20a445b
Update API model
aws-sdk-swift-automation Oct 9, 2024
6394a07
Update endpoints model
aws-sdk-swift-automation Oct 9, 2024
fd2ae87
chore: Updates version to 1.0.16
aws-sdk-swift-automation Oct 9, 2024
4e794c3
Update API model
aws-sdk-swift-automation Oct 10, 2024
2aa8a8a
chore: Updates version to 1.0.17
aws-sdk-swift-automation Oct 10, 2024
a5548ec
chore: Use macOS 15 with Xcode 16 on CI (#1786)
jbelkins Oct 10, 2024
fea9410
Pull in Smithy-only model change from models. (#1787)
sichanyoo Oct 11, 2024
f544513
Update API model
aws-sdk-swift-automation Oct 11, 2024
de7fefa
chore: Updates version to 1.0.18
aws-sdk-swift-automation Oct 11, 2024
6fa406b
Update API model
aws-sdk-swift-automation Oct 14, 2024
fb87af9
Update endpoints model
aws-sdk-swift-automation Oct 14, 2024
35e65e2
chore: Updates version to 1.0.19
aws-sdk-swift-automation Oct 14, 2024
5299076
chore: deprecate worklink (#1788)
dayaffe Oct 14, 2024
2397510
fix: Catch-up with pre-GA model changes (#1790)
jbelkins Oct 14, 2024
69d2a11
Update API model
aws-sdk-swift-automation Oct 15, 2024
d234977
Update endpoints model
aws-sdk-swift-automation Oct 15, 2024
3aafd4f
chore: Updates version to 1.0.20
aws-sdk-swift-automation Oct 15, 2024
e240d76
Update API model
aws-sdk-swift-automation Oct 16, 2024
f3d6858
chore: Updates version to 1.0.21
aws-sdk-swift-automation Oct 16, 2024
bd8120f
Update API model
aws-sdk-swift-automation Oct 17, 2024
bdf8101
chore: Updates version to 1.0.22
aws-sdk-swift-automation Oct 17, 2024
082ead3
chore: Remove dev preview notice from API docs (#1792)
jbelkins Oct 17, 2024
5399bdb
Update API model
aws-sdk-swift-automation Oct 18, 2024
294a044
chore: Updates version to 1.0.23
aws-sdk-swift-automation Oct 18, 2024
a1cd7d9
chore: Disable S3 concurrent integration tests on Apple platforms (#1…
jbelkins Oct 18, 2024
1310c5a
feat: Enable sigv4a for SESv2 service (#1795)
jbelkins Oct 21, 2024
fb7a85c
chore: Remove "dev preview" notice from API docs (#1793)
jbelkins Oct 21, 2024
e616bae
Update API model
aws-sdk-swift-automation Oct 21, 2024
165f0b5
chore: Updates version to 1.0.24
aws-sdk-swift-automation Oct 21, 2024
c5dd077
chore: Disable S3 concurrent tests on visionOS (#1796)
jbelkins Oct 21, 2024
7b08026
chore: Update to Smithy 1.52 (#1797)
jbelkins Oct 22, 2024
6f2002a
Update API model
aws-sdk-swift-automation Oct 22, 2024
c3287fb
Update endpoints model
aws-sdk-swift-automation Oct 22, 2024
4d8973f
chore: Updates version to 1.0.25
aws-sdk-swift-automation Oct 22, 2024
e9bea35
chore: Add aws_json error code tests (#1798)
jbelkins Oct 23, 2024
3fe53ab
Update API model
aws-sdk-swift-automation Oct 23, 2024
818f0a0
Update endpoints model
aws-sdk-swift-automation Oct 23, 2024
b4f5e6e
chore: Updates version to 1.0.26
aws-sdk-swift-automation Oct 23, 2024
a666488
chore: Bump CRT version to 0.37.0. (#1801)
sichanyoo Oct 23, 2024
6b89e23
chore: Run CLI unit tests in CI (#1799)
jbelkins Oct 23, 2024
cc9d241
feat!: Remove AWS Nimble (#1804)
sichanyoo Oct 24, 2024
d166c94
Update API model
aws-sdk-swift-automation Oct 24, 2024
257e689
Update endpoints model
aws-sdk-swift-automation Oct 24, 2024
bb1d1d5
chore: Updates version to 1.0.27
aws-sdk-swift-automation Oct 24, 2024
28ac842
chore: Use Smithy 1.52.1 (#1802)
jbelkins Oct 24, 2024
0e35a89
Update API model
aws-sdk-swift-automation Oct 25, 2024
a3b695a
Update endpoints model
aws-sdk-swift-automation Oct 25, 2024
95c5117
chore: Updates version to 1.0.28
aws-sdk-swift-automation Oct 25, 2024
2f4cac0
Merge branch 'main' into jbe/wtf_bridge
jbelkins Oct 28, 2024
afcc825
Merge remote-tracking branch 'origin/main' into jbe/wtf_bridge
jbelkins Oct 29, 2024
c632b46
Cleanup
jbelkins Oct 29, 2024
362890d
Merge branch 'main' into jbe/wtf_bridge
jbelkins Nov 6, 2024
587cb76
Add high-concurrency transcribe streaming tests; enable S3 concurrent…
jbelkins Nov 8, 2024
3b9a605
Merge branch 'main' into jbe/better_bridge
jbelkins Nov 8, 2024
acf646f
Remove unwanted files
jbelkins Nov 8, 2024
7045657
Empty commit
jbelkins Nov 8, 2024
4eec282
Merge remote-tracking branch 'origin/main' into jbe/better_bridge
jbelkins Nov 9, 2024
7e1cd56
Merge remote-tracking branch 'origin/main' into jbe/better_bridge
jbelkins Nov 11, 2024
e2d6296
Single transcribe test now retries on throttling or concurrency servi…
jbelkins Nov 11, 2024
a7f1f8e
Merge remote-tracking branch 'origin/main' into jbe/better_bridge
jbelkins Nov 13, 2024
6896502
Threadsafe Context
jbelkins Nov 13, 2024
21d8919
Fix tests
jbelkins Nov 13, 2024
aff7399
Merge remote-tracking branch 'origin/main' into jbe/better_bridge
jbelkins Nov 13, 2024
64a4a5b
Improved concurrency tests
jbelkins Nov 13, 2024
faf66d8
Turn off thread sanitizer
jbelkins Nov 13, 2024
54939de
Cleanup
jbelkins Nov 13, 2024
887c54e
Merge remote-tracking branch 'origin/main' into jbe/better_bridge
jbelkins Nov 13, 2024
4f6c758
Test cleanup
jbelkins Nov 13, 2024
eca516a
Merge branch 'main' into jbe/better_bridge
jbelkins Nov 13, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ SmokeTests/
# Allow the AWSSDKSwiftCLI Package.resolved
# while excluding all other Package.resolved files
!/AWSSDKSwiftCLI/Package.resolved

# Xcode config that is for the installed copy only
xcuserdata
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,69 @@ import XCTest
import AWSS3
import AWSIntegrationTestUtils

class S3ConcurrentTests: S3XCTestCase {
public var fileData: Data!
let MEGABYTE: Double = 1_000_000

#if !os(macOS) && !os(iOS) && !os(tvOS) && !os(visionOS)
// Payload below 1,048,576 bytes; sends as simple data payload
func test_20x_1MB_getObject() async throws {
fileData = try generateDummyTextData(numMegabytes: MEGABYTE)
try await repeatConcurrentlyWithArgs(count: 20, test: getObject, args: fileData!)
final class S3ConcurrentTests: S3XCTestCase {
private var fileData: Data!

// Payload just below chunked threshold
// Tests concurrent upload of simple data payloads
func test_10x_1MB_getObject() async throws {
fileData = try generateDummyTextData(count: CHUNKED_THRESHOLD - 1)
try await repeatConcurrentlyWithArgs(count: 10, test: getObject, args: fileData!)
}

// Payload at chunked threshold, just large enough to chunk
// Tests concurrent upload with aws-chunked encoding & flexible checksums
func test_10x_1_5MB_getObject() async throws {
fileData = try generateDummyTextData(count: CHUNKED_THRESHOLD)
try await repeatConcurrentlyWithArgs(count: 10, test: getObject, args: fileData!)
}

// Payload over 1,048,576 bytes; uses aws chunked encoding & flexible checksum
func test_20x_1_5MB_getObject() async throws {
fileData = try generateDummyTextData(numMegabytes: MEGABYTE * 1.5)
try await repeatConcurrentlyWithArgs(count: 20, test: getObject, args: fileData!)
// Payload 256 bytes with 200 concurrent requests, sends as simple data
// Tests very high concurrency with small data payloads
func test_200x_256B_getObject() async throws {
fileData = try generateDummyTextData(count: 256)
try await repeatConcurrentlyWithArgs(count: 200, test: getObject, args: fileData!)
}
#endif

/* Helper functions */
// MARK: - Private methods

// Generates text data in increments of 10 bytes
func generateDummyTextData(numMegabytes: Double) throws -> Data {
let segmentData = Data("1234567890".utf8)
// Generates text data of the exact length requested
private func generateDummyTextData(count: Int) throws -> Data {
let segment = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
let segmentData = Data(segment.utf8)
var wholeData = Data()
for _ in 0..<(Int(numMegabytes)/10) {
wholeData.append(segmentData)
for _ in 0..<(count / segmentData.count + 1) {
wholeData.append(contentsOf: segmentData.shuffled())
}
return wholeData
// Truncate data to exactly the required length
return wholeData.subdata(in: 0..<count)
}

// Puts data to S3, gets the uploaded file, then asserts retrieved data equals original data
func getObject(args: Any...) async throws {
// Puts data to S3, gets the uploaded file, asserts retrieved data == original data, deletes S3 object
private func getObject(args: Any...) async throws {

// Take the test data and crate a PutObject request to send it
guard let data = args[0] as? Data else {
throw ClientError.dataNotFound("Failed to retrieve dummy data.")
}
let file = ByteStream.data(data)
let objectKey = UUID().uuidString.split(separator: "-").first!.lowercased()
let putObjectInput = PutObjectInput(body: file, bucket: bucketName, key: objectKey)

// Put the test data to S3
_ = try await client.putObject(input: putObjectInput)

// Read the response's data stream into memory
let retrievedData = try await client.getObject(input: GetObjectInput(
bucket: bucketName, key: objectKey
)).body?.readData()

// Compare the retrieved data to the uploaded data to show they are equal
XCTAssertEqual(data, retrievedData)

// Delete the S3 object once the test has been verified
// Calling DeleteObject here allows for concurrent deletion, accelerating test teardown
let deleteObjectInput = DeleteObjectInput(bucket: bucketName, key: objectKey)
_ = try await client.deleteObject(input: deleteObjectInput)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,39 @@
//

import XCTest
import AWSIntegrationTestUtils
import Foundation
import AWSTranscribeStreaming
import protocol AWSClientRuntime.AWSServiceError

final class TranscribeStreamingTests: XCTestCase {

func testStartStreamTranscription() async throws {
// MARK: - Test transcription

// The heelo-swift.wav resource is an audio file that contains an automated voice
func test_single_streamTranscription() async throws {
try await attempt()
}

// Concurrent stream transcription frequently fails on the CRT HTTP client with errors
// such as:
// code: 2058, message: "The connection has closed or is closing."
// code: 2087, message: "Stream acquisition failed because stream manager failed to acquire a connection"
//
// Disable this test on the CRT client until these failures can be investigated & corrected.
#if !os(Linux) && !os(Windows)
func test_25xConcurrent_streamTranscription() async throws {
// By default the TranscribeStreaming service allows 25 concurrent transcriptions.
// More than that (which can happen when multiple test runs are being performed) will result
// in throttling / resource exceeded errors, which may be retried (see retry logic below.)
try await repeatConcurrently(count: 25, test: attempt)
}
#endif

// MARK: - Private / implementation methods

private func performStreamTranscription() async throws {

// The hello-swift.wav resource is an audio file that contains an automated voice
// saying the words "Hello transcribed streaming from Swift S. D. K.".
// It is 2.976 seconds in duration.
let audioURL = Bundle.module.url(forResource: "hello-swift", withExtension: "wav")!
Expand Down Expand Up @@ -82,4 +107,25 @@ final class TranscribeStreamingTests: XCTestCase {
]
XCTAssertTrue(candidates.contains(where: { $0.lowercased() == fullMessage.lowercased() }))
}

// Performs the stream transcription, with retry for selected errors associated with
// rate limiting & throttling.
//
// Normal retry is not applied to transcribe streaming because the request body is a
// non-rewindable stream.
private func attempt() async throws {
// These throttling / resource limit errors may be returned based on the number of
// recent requests made to AWSTranscribeStreaming.
let retryableCodes: [String?] = ["ThrottlingException", "LimitExceededException"]

// Perform the transcribe operation, with special handling for the two retryable errors.
do {
try await self.performStreamTranscription()
} catch let error as AWSServiceError where retryableCodes.contains(error.errorCode) {
// Wait randomly between 1-3 sec, then attempt again.
try await Task.sleep(nanoseconds: UInt64.random(in: 1_000_000_000...3_000_000_000))
try await self.attempt()
}
// Any other error thrown is not caught and will fail the test.
}
}
Loading