Skip to content

Commit

Permalink
chore: Adding more AWSS3StoragePlugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas committed Oct 12, 2023
1 parent 78f95fc commit e2bc2ec
Show file tree
Hide file tree
Showing 12 changed files with 2,655 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import AWSClientRuntime
/// and allows for mocking in unit tests. The methods contain no other logic other than calling the
/// same method using the AWSS3 instance.
class AWSS3Adapter: AWSS3Behavior {
let awsS3: S3Client
let awsS3: S3ClientProtocol
let config: S3Client.S3ClientConfiguration

init(_ awsS3: S3Client, config: S3Client.S3ClientConfiguration) {
init(_ awsS3: S3ClientProtocol, config: S3Client.S3ClientConfiguration) {
self.awsS3 = awsS3
self.config = config
}
Expand Down Expand Up @@ -161,7 +161,7 @@ class AWSS3Adapter: AWSS3Behavior {

/// Instance of S3 service.
/// - Returns: S3 service instance.
func getS3() -> S3Client {
func getS3() -> S3ClientProtocol {
return awsS3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protocol AWSS3Behavior {
func abortMultipartUpload(_ request: AWSS3AbortMultipartUploadRequest, completion: @escaping (Result<Void, StorageError>) -> Void)

// Gets a client for AWS S3 Service.
func getS3() -> S3Client
func getS3() -> S3ClientProtocol

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy {
httpClientEngineProxy: HttpClientEngineProxy? = nil,
storageConfiguration: StorageConfiguration = .default,
storageTransferDatabase: StorageTransferDatabase = .default,
fileSystem: FileSystem = .default,
sessionConfiguration: URLSessionConfiguration? = nil,
delegateQueue: OperationQueue? = nil,
logger: Logger = storageLogger) throws {
Expand Down Expand Up @@ -97,7 +98,9 @@ class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy {
self.init(authService: authService,
storageConfiguration: storageConfiguration,
storageTransferDatabase: storageTransferDatabase,
fileSystem: fileSystem,
sessionConfiguration: _sessionConfiguration,
logger: logger,
s3Client: s3Client,
preSignedURLBuilder: preSignedURLBuilder,
awsS3: awsS3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ class StorageMultipartUploadSession {

private let transferTask: StorageTransferTask

private var contentType: String? {
transferTask.contentType
}

private var requestHeaders: RequestHeaders? {
transferTask.requestHeaders
}

init(client: StorageMultipartUploadClient,
bucket: String,
key: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ class StorageTransferTask {
}
}

private var cancelled: Bool {
status == .cancelled
}

var isFailed: Bool {
status == .error
}
Expand Down Expand Up @@ -324,7 +320,7 @@ class StorageTransferTask {
logger.warn("Unable to complete after cancelled")
return
}
guard _status == .completed else {
guard _status != .completed else {
logger.warn("Task is already completed")
return
}
Expand Down
Loading

0 comments on commit e2bc2ec

Please sign in to comment.