From 168e4004f159e9d7601aed32bb3aeaa4fb0eb277 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Fri, 5 Apr 2024 15:44:19 -0700 Subject: [PATCH 1/2] Update codegen tests to have .withSocketTimeout addition. --- .../amazon/smithy/aws/swift/codegen/EventStreamTests.kt | 1 + .../smithy/aws/swift/codegen/PresignerGeneratorTests.kt | 4 ++++ .../aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt | 1 + .../codegen/customizations/FlexibleChecksumMiddlewareTests.kt | 1 + 4 files changed, 7 insertions(+) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt index ee0fcfdf377..23ad73e697e 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt @@ -201,6 +201,7 @@ extension EventStreamTestClientTypes.TestStream: ClientRuntime.MessageUnmarshall .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a") .withRegion(value: config.region) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt index 3ac3d4844f6..d84ac775b22 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt @@ -34,6 +34,7 @@ extension GetFooInput { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withFlowType(value: .PRESIGN_REQUEST) .withExpiration(value: expiration) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") @@ -91,6 +92,7 @@ extension PostFooInput { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withFlowType(value: .PRESIGN_REQUEST) .withExpiration(value: expiration) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") @@ -151,6 +153,7 @@ extension PutFooInput { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withFlowType(value: .PRESIGN_REQUEST) .withExpiration(value: expiration) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") @@ -209,6 +212,7 @@ extension PutObjectInput { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withFlowType(value: .PRESIGN_REQUEST) .withExpiration(value: expiration) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt index 4d59e16960e..73fd9c20348 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt @@ -32,6 +32,7 @@ class AWSQueryOperationStackTest { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a") .withRegion(value: config.region) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt index 0f59a0c7765..b7ce47bd1eb 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt @@ -36,6 +36,7 @@ extension ChecksumTestsClient { .withAuthSchemes(value: config.authSchemes ?? []) .withAuthSchemeResolver(value: config.authSchemeResolver) .withUnsignedPayloadTrait(value: false) + .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a") .withRegion(value: config.region) From fdbeb530eef3a484fcad93afafc6d2d8c41c7dd0 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 8 Apr 2024 09:27:58 -0700 Subject: [PATCH 2/2] Add Date header to mocked response; needed for retry middleware. --- .../Services/AWSS3IntegrationTests/S3ErrorIn200Test.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/IntegrationTests/Services/AWSS3IntegrationTests/S3ErrorIn200Test.swift b/IntegrationTests/Services/AWSS3IntegrationTests/S3ErrorIn200Test.swift index 7c2791581c2..54a72f3c998 100644 --- a/IntegrationTests/Services/AWSS3IntegrationTests/S3ErrorIn200Test.swift +++ b/IntegrationTests/Services/AWSS3IntegrationTests/S3ErrorIn200Test.swift @@ -26,6 +26,7 @@ public class MockHttpClientEngine: HTTPClient { WWoZlnK4pTjKCYn6eNV7GgOurabfqLkjbSyqTvDMGBaI9uwzyNhSaDhOCPs8paFGye7S6b/AB3A= """ + request.withHeader(name: "Date", value: "Wed, 21 Oct 2015 07:28:00 GMT") return HttpResponse( headers: request.headers, body: ByteStream.data(errorResponsePayload.data(using: .utf8)),