forked from TrueCloudLab/frostfs-s3-gw
[#370] Fix multipart upload size in tree node
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
399a6d6d65
commit
3f1ebde426
2 changed files with 18 additions and 2 deletions
|
@ -92,6 +92,22 @@ func TestDeleteMultipartAllParts(t *testing.T) {
|
|||
require.Empty(t, hc.tp.Objects())
|
||||
}
|
||||
|
||||
func TestMultipartTreeSize(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
|
||||
partSize := layer.UploadMinSize
|
||||
objLen := 6 * partSize
|
||||
|
||||
bktName, objName := "bucket", "object"
|
||||
|
||||
bktInfo := createTestBucket(hc, bktName)
|
||||
multipartUpload(hc, bktName, objName, nil, objLen, partSize)
|
||||
|
||||
nodeVersion, err := hc.tree.GetLatestVersion(hc.Context(), bktInfo, objName)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, objLen, nodeVersion.Size)
|
||||
}
|
||||
|
||||
func TestMultipartUploadInvalidPart(t *testing.T) {
|
||||
hc := prepareHandlerContext(t)
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Extend
|
|||
OID: id,
|
||||
ETag: hex.EncodeToString(hash),
|
||||
FilePath: p.Object,
|
||||
Size: size,
|
||||
Size: p.Size,
|
||||
},
|
||||
IsUnversioned: !bktSettings.VersioningEnabled(),
|
||||
IsCombined: p.Header[MultipartObjectSize] != "",
|
||||
|
@ -356,7 +356,7 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Extend
|
|||
Owner: n.gateOwner,
|
||||
Bucket: p.BktInfo.Name,
|
||||
Name: p.Object,
|
||||
Size: size,
|
||||
Size: size, // we don't use here p.Size to be consistent with the objectInfoFromMeta function
|
||||
Created: prm.CreationTime,
|
||||
Headers: p.Header,
|
||||
ContentType: p.Header[api.ContentType],
|
||||
|
|
Loading…
Reference in a new issue