Skip to content

Commit

Permalink
Copy logger to new AWSClient
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 16, 2024
1 parent 5e48754 commit a5214e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Sources/Soto/Extensions/S3/S3ExpressSigning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ extension S3 {
let client = AWSClient(
credentialProvider: .s3Express(bucket: bucket, s3: self),
middleware: S3ExpressSigningFixupMiddleware(),
httpClient: self.client.httpClient
httpClient: self.client.httpClient,
logger: self.client.logger
)
let s3 = S3(client: client, region: self.region, timeout: self.config.timeout, options: self.config.options)
return (client, s3)
Expand Down
12 changes: 7 additions & 5 deletions Tests/SotoTests/Services/S3/S3Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -594,28 +594,30 @@ class S3Tests: XCTestCase {
createBucketConfiguration: .init(
bucket: .init(dataRedundancy: .singleAvailabilityZone, type: .directory),
location: .init(name: "use1-az6", type: .availabilityZone)
)
),
logger: TestEnvironment.logger
)
try await Self.s3.waitUntilBucketExists(.init(bucket: bucket), logger: TestEnvironment.logger)
} catch let error as S3ErrorType where error == .bucketAlreadyOwnedByYou {}
try await withTeardown {
let (client, expressS3) = Self.s3.createS3ExpressClientAndService(bucket: bucket)
try await withTeardown {

let putResponse = try await expressS3.putObject(
body: .init(buffer: ByteBuffer(string: "Uploaded")),
bucket: bucket,
key: "test-file"
key: "test-file",
logger: TestEnvironment.logger
)
print(putResponse)
let getResponse = try await expressS3.getObject(
bucket: bucket,
key: "test-file"
key: "test-file",
logger: TestEnvironment.logger
)
let body = try await getResponse.body.collect(upTo: .max)
XCTAssertEqual(body, ByteBuffer(string: "Uploaded"))

_ = try await expressS3.deleteObject(bucket: bucket, key: "test-file")
_ = try await expressS3.deleteObject(bucket: bucket, key: "test-file", logger: TestEnvironment.logger)
} teardown: {
try? await client.shutdown()
}
Expand Down

0 comments on commit a5214e1

Please sign in to comment.