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: fix integration tests #1268

Merged
merged 1 commit into from
Dec 20, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
import AWSS3
import ClientRuntime

final class S3StreamTests: S3XCTestCase {
let objectName = "hello-world"
Expand All @@ -25,6 +26,8 @@ final class S3StreamTests: S3XCTestCase {
case .stream(let stream):
let actual = String(data: try await stream.readToEndAsync()!, encoding: .utf8)
XCTAssertEqual(actual, expected)
case .noStream:
XCTFail("Expected stream")
}
}

Expand All @@ -40,7 +43,8 @@ final class S3StreamTests: S3XCTestCase {
func test_putObject_givenStreamBody() async throws {
let audioURL = Bundle.module.url(forResource: objectName, withExtension: nil)!
let fileHandle = FileHandle(forReadingAtPath: audioURL.relativePath)!
let input = PutObjectInput(body: .from(fileHandle: fileHandle), bucket: bucketName, key: objectName)
let fileByteStream = try ByteStream.data(try fileHandle.readToEnd() ?? Data())
let input = PutObjectInput(body: fileByteStream, bucket: bucketName, key: objectName)
let output = try await client.putObject(input: input)
XCTAssertNotNil(output)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class S3XCTestCase: XCTestCase {
return String(data: data, encoding: .utf8)
case .stream(let stream):
return String(data: try await stream.readToEndAsync()!, encoding: .utf8)
case .noStream:
return nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSAPIGateway/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10050,7 +10050,7 @@ extension GetExportOutput: ClientRuntime.HttpResponseBinding {
self.body = data
case .stream(let stream):
self.body = try stream.readToEnd()
case .none:
case .noStream:
self.body = nil
}
}
Expand Down Expand Up @@ -12593,7 +12593,7 @@ extension GetSdkOutput: ClientRuntime.HttpResponseBinding {
self.body = data
case .stream(let stream):
self.body = try stream.readToEnd()
case .none:
case .noStream:
self.body = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSApiGatewayV2/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6111,7 +6111,7 @@ extension ExportApiOutput: ClientRuntime.HttpResponseBinding {
self.body = data
case .stream(let stream):
self.body = try stream.readToEnd()
case .none:
case .noStream:
self.body = nil
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Services/AWSAppConfig/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ extension CreateHostedConfigurationVersionOutput: ClientRuntime.HttpResponseBind
self.content = data
case .stream(let stream):
self.content = try stream.readToEnd()
case .none:
case .noStream:
self.content = nil
}
}
Expand Down Expand Up @@ -3762,7 +3762,7 @@ extension GetConfigurationOutput: ClientRuntime.HttpResponseBinding {
self.content = data
case .stream(let stream):
self.content = try stream.readToEnd()
case .none:
case .noStream:
self.content = nil
}
}
Expand Down Expand Up @@ -5065,7 +5065,7 @@ extension GetHostedConfigurationVersionOutput: ClientRuntime.HttpResponseBinding
self.content = data
case .stream(let stream):
self.content = try stream.readToEnd()
case .none:
case .noStream:
self.content = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSAppConfigData/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ extension GetLatestConfigurationOutput: ClientRuntime.HttpResponseBinding {
self.configuration = data
case .stream(let stream):
self.configuration = try stream.readToEnd()
case .none:
case .noStream:
self.configuration = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSAppSync/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6438,7 +6438,7 @@ extension GetIntrospectionSchemaOutput: ClientRuntime.HttpResponseBinding {
self.schema = data
case .stream(let stream):
self.schema = try stream.readToEnd()
case .none:
case .noStream:
self.schema = nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSBackupStorage/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ extension GetChunkOutput: ClientRuntime.HttpResponseBinding {
self.data = .data(data)
case .stream(let stream):
self.data = .stream(stream)
case .none:
case .noStream:
self.data = nil
}
}
Expand Down Expand Up @@ -589,7 +589,7 @@ extension GetObjectMetadataOutput: ClientRuntime.HttpResponseBinding {
self.metadataBlob = .data(data)
case .stream(let stream):
self.metadataBlob = .stream(stream)
case .none:
case .noStream:
self.metadataBlob = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSBedrockRuntime/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ extension InvokeModelOutput: ClientRuntime.HttpResponseBinding {
self.body = data
case .stream(let stream):
self.body = try stream.readToEnd()
case .none:
case .noStream:
self.body = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSCloudFront/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11196,7 +11196,7 @@ extension GetFunctionOutput: ClientRuntime.HttpResponseBinding {
self.functionCode = data
case .stream(let stream):
self.functionCode = try stream.readToEnd()
case .none:
case .noStream:
self.functionCode = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSCodeGuruProfiler/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ extension GetProfileOutput: ClientRuntime.HttpResponseBinding {
self.profile = data
case .stream(let stream):
self.profile = try stream.readToEnd()
case .none:
case .noStream:
self.profile = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSCodeartifact/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3543,7 +3543,7 @@ extension GetPackageVersionAssetOutput: ClientRuntime.HttpResponseBinding {
self.asset = .data(data)
case .stream(let stream):
self.asset = .stream(stream)
case .none:
case .noStream:
self.asset = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSEBS/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ extension GetSnapshotBlockOutput: ClientRuntime.HttpResponseBinding {
self.blockData = .data(data)
case .stream(let stream):
self.blockData = .stream(stream)
case .none:
case .noStream:
self.blockData = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSGlacier/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ extension GetJobOutputOutput: ClientRuntime.HttpResponseBinding {
self.body = .data(data)
case .stream(let stream):
self.body = .stream(stream)
case .none:
case .noStream:
self.body = nil
}
self.status = httpResponse.statusCode.rawValue
Expand Down
6 changes: 3 additions & 3 deletions Sources/Services/AWSIoTDataPlane/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ extension DeleteThingShadowOutput: ClientRuntime.HttpResponseBinding {
self.payload = data
case .stream(let stream):
self.payload = try stream.readToEnd()
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down Expand Up @@ -354,7 +354,7 @@ extension GetThingShadowOutput: ClientRuntime.HttpResponseBinding {
self.payload = data
case .stream(let stream):
self.payload = try stream.readToEnd()
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down Expand Up @@ -1516,7 +1516,7 @@ extension UpdateThingShadowOutput: ClientRuntime.HttpResponseBinding {
self.payload = data
case .stream(let stream):
self.payload = try stream.readToEnd()
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSIoTWireless/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7364,7 +7364,7 @@ extension GetPositionEstimateOutput: ClientRuntime.HttpResponseBinding {
self.geoJsonPayload = data
case .stream(let stream):
self.geoJsonPayload = try stream.readToEnd()
case .none:
case .noStream:
self.geoJsonPayload = nil
}
}
Expand Down Expand Up @@ -7898,7 +7898,7 @@ extension GetResourcePositionOutput: ClientRuntime.HttpResponseBinding {
self.geoJsonPayload = data
case .stream(let stream):
self.geoJsonPayload = try stream.readToEnd()
case .none:
case .noStream:
self.geoJsonPayload = nil
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ extension GetClipOutput: ClientRuntime.HttpResponseBinding {
self.payload = .data(data)
case .stream(let stream):
self.payload = .stream(stream)
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down Expand Up @@ -1584,7 +1584,7 @@ extension GetMediaForFragmentListOutput: ClientRuntime.HttpResponseBinding {
self.payload = .data(data)
case .stream(let stream):
self.payload = .stream(stream)
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSKinesisVideoMedia/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ extension GetMediaOutput: ClientRuntime.HttpResponseBinding {
self.payload = .data(data)
case .stream(let stream):
self.payload = .stream(stream)
case .none:
case .noStream:
self.payload = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSLakeFormation/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5598,7 +5598,7 @@ extension GetWorkUnitResultsOutput: ClientRuntime.HttpResponseBinding {
self.resultStream = .data(data)
case .stream(let stream):
self.resultStream = .stream(stream)
case .none:
case .noStream:
self.resultStream = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSLambda/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10530,7 +10530,7 @@ extension InvokeOutput: ClientRuntime.HttpResponseBinding {
self.payload = data
case .stream(let stream):
self.payload = try stream.readToEnd()
case .none:
case .noStream:
self.payload = nil
}
self.statusCode = httpResponse.statusCode.rawValue
Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSLexRuntimeService/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ extension PostContentOutput: ClientRuntime.HttpResponseBinding {
self.audioStream = .data(data)
case .stream(let stream):
self.audioStream = .stream(stream)
case .none:
case .noStream:
self.audioStream = nil
}
}
Expand Down Expand Up @@ -2763,7 +2763,7 @@ extension PutSessionOutput: ClientRuntime.HttpResponseBinding {
self.audioStream = .data(data)
case .stream(let stream):
self.audioStream = .stream(stream)
case .none:
case .noStream:
self.audioStream = nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSLexRuntimeV2/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2388,7 +2388,7 @@ extension PutSessionOutput: ClientRuntime.HttpResponseBinding {
self.audioStream = .data(data)
case .stream(let stream):
self.audioStream = .stream(stream)
case .none:
case .noStream:
self.audioStream = nil
}
}
Expand Down Expand Up @@ -2928,7 +2928,7 @@ extension RecognizeUtteranceOutput: ClientRuntime.HttpResponseBinding {
self.audioStream = .data(data)
case .stream(let stream):
self.audioStream = .stream(stream)
case .none:
case .noStream:
self.audioStream = nil
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Services/AWSLocation/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6844,7 +6844,7 @@ extension GetMapGlyphsOutput: ClientRuntime.HttpResponseBinding {
self.blob = data
case .stream(let stream):
self.blob = try stream.readToEnd()
case .none:
case .noStream:
self.blob = nil
}
}
Expand Down Expand Up @@ -6990,7 +6990,7 @@ extension GetMapSpritesOutput: ClientRuntime.HttpResponseBinding {
self.blob = data
case .stream(let stream):
self.blob = try stream.readToEnd()
case .none:
case .noStream:
self.blob = nil
}
}
Expand Down Expand Up @@ -7117,7 +7117,7 @@ extension GetMapStyleDescriptorOutput: ClientRuntime.HttpResponseBinding {
self.blob = data
case .stream(let stream):
self.blob = try stream.readToEnd()
case .none:
case .noStream:
self.blob = nil
}
}
Expand Down Expand Up @@ -7268,7 +7268,7 @@ extension GetMapTileOutput: ClientRuntime.HttpResponseBinding {
self.blob = data
case .stream(let stream):
self.blob = try stream.readToEnd()
case .none:
case .noStream:
self.blob = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSMediaLive/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9112,7 +9112,7 @@ extension DescribeInputDeviceThumbnailOutput: ClientRuntime.HttpResponseBinding
self.body = .data(data)
case .stream(let stream):
self.body = .stream(stream)
case .none:
case .noStream:
self.body = nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Services/AWSMediaStoreData/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ extension GetObjectOutput: ClientRuntime.HttpResponseBinding {
self.body = .data(data)
case .stream(let stream):
self.body = .stream(stream)
case .none:
case .noStream:
self.body = nil
}
self.statusCode = httpResponse.statusCode.rawValue
Expand Down
4 changes: 2 additions & 2 deletions Sources/Services/AWSMedicalImaging/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ extension GetImageFrameOutput: ClientRuntime.HttpResponseBinding {
self.imageFrameBlob = .data(data)
case .stream(let stream):
self.imageFrameBlob = .stream(stream)
case .none:
case .noStream:
self.imageFrameBlob = nil
}
}
Expand Down Expand Up @@ -2135,7 +2135,7 @@ extension GetImageSetMetadataOutput: ClientRuntime.HttpResponseBinding {
self.imageSetMetadataBlob = .data(data)
case .stream(let stream):
self.imageSetMetadataBlob = .stream(stream)
case .none:
case .noStream:
self.imageSetMetadataBlob = nil
}
}
Expand Down
Loading
Loading