From 89ff89a32bce202fab79d03025f2f220d5e13875 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 27 May 2022 14:53:40 +0300 Subject: [PATCH] [#463] Define default location constraint Fixes `test_bucket_get_location` from s3-tests. Signed-off-by: Alex Vanin --- api/layer/container.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/layer/container.go b/api/layer/container.go index 3a4ac91d..64cafb9f 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -28,6 +28,7 @@ type ( const ( attributeLocationConstraint = ".s3-location-constraint" + defaultLocationConstraint = "default" AttributeLockEnabled = "LockEnabled" ) @@ -123,6 +124,9 @@ func (n *layer) containerList(ctx context.Context) ([]*data.BucketInfo, error) { func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*data.BucketInfo, error) { var err error ownerID := n.Owner(ctx) + if p.LocationConstraint == "" { + p.LocationConstraint = defaultLocationConstraint // s3tests_boto3.functional.test_s3:test_bucket_get_location + } bktInfo := &data.BucketInfo{ Name: p.Name, Owner: ownerID, @@ -134,11 +138,9 @@ func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*da var attributes [][2]string - if p.LocationConstraint != "" { - attributes = append(attributes, [2]string{ - attributeLocationConstraint, p.LocationConstraint, - }) - } + attributes = append(attributes, [2]string{ + attributeLocationConstraint, p.LocationConstraint, + }) if p.ObjectLockEnabled { attributes = append(attributes, [2]string{