[#306] Fix update settings for buckets without owner key in tree
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
c868af8a62
commit
ff15f9f28a
2 changed files with 18 additions and 1 deletions
|
@ -379,6 +379,21 @@ func TestCreateBucket(t *testing.T) {
|
|||
createBucketAssertS3Error(hc, bktName, box2, s3errors.ErrBucketAlreadyExists)
|
||||
}
|
||||
|
||||
func TestCreateOldBucketPutVersioning(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
hc.config.aclEnabled = true
|
||||
bktName := "bkt-name"
|
||||
|
||||
info := createBucket(hc, bktName)
|
||||
settings, err := hc.tree.GetSettingsNode(hc.Context(), info.BktInfo)
|
||||
require.NoError(t, err)
|
||||
settings.OwnerKey = nil
|
||||
err = hc.tree.PutSettingsNode(hc.Context(), info.BktInfo, settings)
|
||||
require.NoError(t, err)
|
||||
|
||||
putBucketVersioning(t, hc, bktName, true)
|
||||
}
|
||||
|
||||
func TestCreateNamespacedBucket(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
bktName := "bkt-name"
|
||||
|
|
|
@ -1397,7 +1397,9 @@ func metaFromSettings(settings *data.BucketSettings) map[string]string {
|
|||
results[versioningKV] = settings.Versioning
|
||||
results[lockConfigurationKV] = encodeLockConfiguration(settings.LockConfiguration)
|
||||
results[cannedACLKV] = settings.CannedACL
|
||||
results[ownerKeyKV] = hex.EncodeToString(settings.OwnerKey.Bytes())
|
||||
if settings.OwnerKey != nil {
|
||||
results[ownerKeyKV] = hex.EncodeToString(settings.OwnerKey.Bytes())
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue