Skip to content

Commit 86e65a0

Browse files
committed
Update test to clean up bucket objects before deleting bucket
1 parent 4a19ae9 commit 86e65a0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/rsstorage/internal/chunks.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ func (w *DefaultChunkUtils) WriteChunked(
4343
// Clear the directory if it already exists
4444
err = w.Server.Remove(ctx, dir, address)
4545
if err != nil {
46-
return nil
46+
err = fmt.Errorf("unable to clear directory before writing: %w", err)
47+
return
4748
}
4849

4950
// Write an `info.json` to the directory

pkg/rsstorage/internal/integration_test/integration_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,15 @@ func (s *S3IntegrationSuite) TestPopulateServerSetHangChunked(c *check.C) {
726726
}
727727
c.Assert(err, check.IsNil)
728728
defer func() {
729+
730+
resp, s3Err := s3Svc.ListObjects(ctx, &s3.ListObjectsV2Input{Bucket: aws.String(bucket)})
731+
c.Assert(s3Err, check.IsNil)
732+
733+
for _, obj := range resp.Contents {
734+
_, delErr := s3Svc.DeleteObject(ctx, &s3.DeleteObjectInput{Bucket: aws.String(bucket), Key: obj.Key})
735+
c.Assert(delErr, check.IsNil)
736+
}
737+
729738
_, deleteErr := s3Svc.DeleteBucket(ctx, &s3.DeleteBucketInput{Bucket: aws.String(bucket)})
730739
c.Assert(deleteErr, check.IsNil)
731740
}()

0 commit comments

Comments
 (0)