-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat: Delete versioned S3 objects #54
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,7 +373,13 @@ func TestS3ObjectsDeleter_DeleteS3Objects(t *testing.T) { | |
return &service.S3ObjectsDeleterOutput{}, nil | ||
}) | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(s3ObjectsDeleterMock, s3BucketLocationGetter) | ||
s3ObjectVersionLister := mock.S3ObjectVersionsLister(func(ctx context.Context, input *service.S3ObjectVersionsListerInput) (*service.S3ObjectVersionsListerOutput, error) { | ||
return &service.S3ObjectVersionsListerOutput{ | ||
Objects: model.S3ObjectIdentifiers{}, | ||
}, nil | ||
}) | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(s3ObjectsDeleterMock, s3BucketLocationGetter, s3ObjectVersionLister) | ||
if _, err := s3ObjectsDeleter.DeleteS3Objects(context.Background(), &usecase.S3ObjectsDeleterInput{ | ||
Bucket: model.Bucket("bucket-name"), | ||
S3ObjectIdentifiers: model.S3ObjectIdentifiers{ | ||
|
@@ -413,7 +419,13 @@ func TestS3ObjectsDeleter_DeleteS3Objects(t *testing.T) { | |
return nil, errors.New("some error") | ||
}) | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(s3ObjectsDeleterMock, s3BucketLocationGetter) | ||
s3ObjectVersionLister := mock.S3ObjectVersionsLister(func(ctx context.Context, input *service.S3ObjectVersionsListerInput) (*service.S3ObjectVersionsListerOutput, error) { | ||
return &service.S3ObjectVersionsListerOutput{ | ||
Objects: model.S3ObjectIdentifiers{}, | ||
}, nil | ||
}) | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(s3ObjectsDeleterMock, s3BucketLocationGetter, s3ObjectVersionLister) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the previous comment, verify that the |
||
if _, err := s3ObjectsDeleter.DeleteS3Objects(context.Background(), &usecase.S3ObjectsDeleterInput{ | ||
Bucket: model.Bucket("bucket-name"), | ||
S3ObjectIdentifiers: model.S3ObjectIdentifiers{ | ||
|
@@ -442,7 +454,7 @@ func TestS3ObjectsDeleter_DeleteS3Objects(t *testing.T) { | |
return nil, errors.New("some error") | ||
}) | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(nil, s3BucketLocationGetter) | ||
s3ObjectsDeleter := NewS3ObjectsDeleter(nil, s3BucketLocationGetter, nil) | ||
if _, err := s3ObjectsDeleter.DeleteS3Objects(context.Background(), &usecase.S3ObjectsDeleterInput{ | ||
Bucket: model.Bucket("bucket-name"), | ||
S3ObjectIdentifiers: model.S3ObjectIdentifiers{ | ||
|
@@ -467,7 +479,7 @@ func TestS3ObjectsDeleter_DeleteS3Objects(t *testing.T) { | |
t.Run("If bucket name is too short, failed to delete objects", func(t *testing.T) { | ||
t.Parallel() | ||
|
||
s3ObjectsDeleter := NewS3ObjectsDeleter(nil, nil) | ||
s3ObjectsDeleter := NewS3ObjectsDeleter(nil, nil, nil) | ||
if _, err := s3ObjectsDeleter.DeleteS3Objects(context.Background(), &usecase.S3ObjectsDeleterInput{ | ||
Bucket: "b", // too short | ||
}); err == nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the
s3ObjectVersionLister
mock is correctly set up to return a meaningful response for testing theDeleteS3Objects
functionality, even if it's an empty list in this case. Consider adding test cases or modifying the mock to return different sets of object versions to more thoroughly test the handling of versioned objects.