kopia lustrzana https://github.com/gaul/s3proxy
Check object size in testMaximumMultipartUpload
Also use constant for part size.pull/345/head
rodzic
df9e77963a
commit
c66e29cd0a
|
@ -1157,15 +1157,18 @@ public final class AwsSdkTest {
|
||||||
blobStoreType.equals("transient"));
|
blobStoreType.equals("transient"));
|
||||||
|
|
||||||
String blobName = "multipart-upload";
|
String blobName = "multipart-upload";
|
||||||
int numParts = 10_000;
|
int numParts = 32;
|
||||||
ByteSource byteSource = TestUtils.randomByteSource().slice(0, numParts);
|
long partSize = MINIMUM_MULTIPART_SIZE;
|
||||||
|
ByteSource byteSource = TestUtils.randomByteSource().slice(
|
||||||
|
0, partSize * numParts);
|
||||||
|
|
||||||
InitiateMultipartUploadResult result = client.initiateMultipartUpload(
|
InitiateMultipartUploadResult result = client.initiateMultipartUpload(
|
||||||
new InitiateMultipartUploadRequest(containerName, blobName));
|
new InitiateMultipartUploadRequest(containerName, blobName));
|
||||||
ImmutableList.Builder<PartETag> parts = ImmutableList.builder();
|
ImmutableList.Builder<PartETag> parts = ImmutableList.builder();
|
||||||
|
|
||||||
for (int i = 0; i < numParts; ++i) {
|
for (int i = 0; i < numParts; ++i) {
|
||||||
ByteSource partByteSource = byteSource.slice(i, 1);
|
ByteSource partByteSource = byteSource.slice(
|
||||||
|
i * partSize, partSize);
|
||||||
UploadPartResult partResult = client.uploadPart(
|
UploadPartResult partResult = client.uploadPart(
|
||||||
new UploadPartRequest()
|
new UploadPartRequest()
|
||||||
.withBucketName(containerName)
|
.withBucketName(containerName)
|
||||||
|
@ -1183,6 +1186,9 @@ public final class AwsSdkTest {
|
||||||
assertThat(listing.getObjectSummaries()).hasSize(1);
|
assertThat(listing.getObjectSummaries()).hasSize(1);
|
||||||
|
|
||||||
S3Object object = client.getObject(containerName, blobName);
|
S3Object object = client.getObject(containerName, blobName);
|
||||||
|
ObjectMetadata contentMetadata = object.getObjectMetadata();
|
||||||
|
assertThat(contentMetadata.getContentLength()).isEqualTo(
|
||||||
|
partSize * numParts);
|
||||||
|
|
||||||
try (InputStream actual = object.getObjectContent();
|
try (InputStream actual = object.getObjectContent();
|
||||||
InputStream expected = byteSource.openStream()) {
|
InputStream expected = byteSource.openStream()) {
|
||||||
|
|
Ładowanie…
Reference in New Issue