Skip to content

Commit

Permalink
Export func IsBucketNotFoundError (#5757)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepikaDixit authored and Ilya Kislenko committed Jun 6, 2019
1 parent 5292adb commit 51533ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/objectstore/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func config(region string) *aws.Config {
return c
}

func isBucketNotFoundError(err error) bool {
func IsBucketNotFoundError(err error) bool {
if err == nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/objectstore/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (p *s3Provider) getRegionForBucket(ctx context.Context, bucketName string)

func (p *s3Provider) getOrCreateBucket(ctx context.Context, bucketName, region string) (Bucket, error) {
d, err := p.GetBucket(ctx, bucketName)
if isBucketNotFoundError(err) {
if IsBucketNotFoundError(err) {
// Create bucket when it does not exist
return p.CreateBucket(ctx, bucketName, region)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/objectstore/objectstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (s *ObjectStoreProviderSuite) TestGetNonExistingBucket(c *C) {
bucketName := s.createBucketName(c)
bucket, err := s.provider.GetBucket(ctx, bucketName)
c.Check(err, NotNil)
c.Assert(isBucketNotFoundError(err), Equals, true)
c.Assert(IsBucketNotFoundError(err), Equals, true)
c.Check(bucket, IsNil)
}

Expand Down

0 comments on commit 51533ff

Please sign in to comment.