[#463] Define default location constraint

Fixes `test_bucket_get_location` from s3-tests.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-05-27 14:53:40 +03:00 committed by Kirillov Denis
parent 087d500c5f
commit 89ff89a32b

View file

@ -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{