s3store: Fix tests by adding ContentLength property
This commit is contained in:
parent
efe8c9ce05
commit
f680b9f1ff
|
@ -750,29 +750,32 @@ func TestWriteChunk(t *testing.T) {
|
||||||
|
|
||||||
// From WriteChunk
|
// From WriteChunk
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(3),
|
PartNumber: aws.Int64(3),
|
||||||
Body: bytes.NewReader([]byte("1234")),
|
Body: bytes.NewReader([]byte("1234")),
|
||||||
|
ContentLength: aws.Int64(4),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-3"),
|
ETag: aws.String("etag-3"),
|
||||||
}, nil)
|
}, nil)
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(4),
|
PartNumber: aws.Int64(4),
|
||||||
Body: bytes.NewReader([]byte("5678")),
|
Body: bytes.NewReader([]byte("5678")),
|
||||||
|
ContentLength: aws.Int64(4),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-4"),
|
ETag: aws.String("etag-4"),
|
||||||
}, nil)
|
}, nil)
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(5),
|
PartNumber: aws.Int64(5),
|
||||||
Body: bytes.NewReader([]byte("90AB")),
|
Body: bytes.NewReader([]byte("90AB")),
|
||||||
|
ContentLength: aws.Int64(4),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-5"),
|
ETag: aws.String("etag-5"),
|
||||||
}, nil)
|
}, nil)
|
||||||
|
@ -888,20 +891,22 @@ func TestWriteChunkPrependsIncompletePart(t *testing.T) {
|
||||||
}).Return(&s3.DeleteObjectOutput{}, nil)
|
}).Return(&s3.DeleteObjectOutput{}, nil)
|
||||||
|
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(1),
|
PartNumber: aws.Int64(1),
|
||||||
Body: bytes.NewReader([]byte("1234")),
|
Body: bytes.NewReader([]byte("1234")),
|
||||||
|
ContentLength: aws.Int64(4),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-1"),
|
ETag: aws.String("etag-1"),
|
||||||
}, nil)
|
}, nil)
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(2),
|
PartNumber: aws.Int64(2),
|
||||||
Body: bytes.NewReader([]byte("5")),
|
Body: bytes.NewReader([]byte("5")),
|
||||||
|
ContentLength: aws.Int64(1),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-2"),
|
ETag: aws.String("etag-2"),
|
||||||
}, nil)
|
}, nil)
|
||||||
|
@ -958,11 +963,12 @@ func TestWriteChunkPrependsIncompletePartAndWritesANewIncompletePart(t *testing.
|
||||||
}).Return(&s3.DeleteObjectOutput{}, nil)
|
}).Return(&s3.DeleteObjectOutput{}, nil)
|
||||||
|
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(1),
|
PartNumber: aws.Int64(1),
|
||||||
Body: bytes.NewReader([]byte("1234")),
|
Body: bytes.NewReader([]byte("1234")),
|
||||||
|
ContentLength: aws.Int64(4),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-1"),
|
ETag: aws.String("etag-1"),
|
||||||
}, nil)
|
}, nil)
|
||||||
|
@ -1019,11 +1025,12 @@ func TestWriteChunkAllowTooSmallLast(t *testing.T) {
|
||||||
Key: aws.String("uploadId.part"),
|
Key: aws.String("uploadId.part"),
|
||||||
}).Return(nil, awserr.New("AccessDenied", "Access Denied.", nil))
|
}).Return(nil, awserr.New("AccessDenied", "Access Denied.", nil))
|
||||||
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
s3obj.EXPECT().UploadPartWithContext(context.Background(), NewUploadPartInputMatcher(&s3.UploadPartInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId"),
|
Key: aws.String("uploadId"),
|
||||||
UploadId: aws.String("multipartId"),
|
UploadId: aws.String("multipartId"),
|
||||||
PartNumber: aws.Int64(3),
|
PartNumber: aws.Int64(3),
|
||||||
Body: bytes.NewReader([]byte("1234567890")),
|
Body: bytes.NewReader([]byte("1234567890")),
|
||||||
|
ContentLength: aws.Int64(10),
|
||||||
})).Return(&s3.UploadPartOutput{
|
})).Return(&s3.UploadPartOutput{
|
||||||
ETag: aws.String("etag-3"),
|
ETag: aws.String("etag-3"),
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
Loading…
Reference in New Issue