diff --git a/.gitignore b/.gitignore index 300d9787a0a..d8974287bdd 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/IntegrationTests/Services/AWSS3IntegrationTests/S3ConcurrentTests.swift b/IntegrationTests/Services/AWSS3IntegrationTests/S3ConcurrentTests.swift index 298c23df66c..5835d5cb86b 100644 --- a/IntegrationTests/Services/AWSS3IntegrationTests/S3ConcurrentTests.swift +++ b/IntegrationTests/Services/AWSS3IntegrationTests/S3ConcurrentTests.swift @@ -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..