Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,29 +177,36 @@ public void subscribe(Subscriber<? super ByteBuffer> s) {
void mpuDefaultSplitImpl_partsFailOfRetryableError_shouldFail(String description,
Long contentLength,
ResponseDefinitionBuilder responseDefinitionBuilder) {
stubUploadPartFailsInitialAttemptSucceedsUponRetryCalls(responseDefinitionBuilder);
List<ByteBuffer> buffers = new ArrayList<>();
buffers.add(SdkBytes.fromUtf8String(RandomStringUtils.randomAscii(10)).asByteBuffer());
buffers.add(SdkBytes.fromUtf8String(RandomStringUtils.randomAscii(10)).asByteBuffer());
AsyncRequestBody asyncRequestBody = new AsyncRequestBody() {
@Override
public Optional<Long> contentLength() {
return Optional.ofNullable(contentLength);
for (int i = 0; i < 3; i++) {
try {
stubUploadPartFailsInitialAttemptSucceedsUponRetryCalls(responseDefinitionBuilder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe consider put this line out of the for loop to prevent multiple stubs. I'm not sure if this will just overwrite the previous stub or cause multiple stub

List<ByteBuffer> buffers = new ArrayList<>();
buffers.add(SdkBytes.fromUtf8String(RandomStringUtils.randomAscii(10)).asByteBuffer());
buffers.add(SdkBytes.fromUtf8String(RandomStringUtils.randomAscii(10)).asByteBuffer());
AsyncRequestBody asyncRequestBody = new AsyncRequestBody() {
@Override
public Optional<Long> contentLength() {
return Optional.ofNullable(contentLength);
}

@Override
public void subscribe(Subscriber<? super ByteBuffer> s) {
Flowable.fromIterable(buffers).subscribe(s);
}
};

assertThatThrownBy(() -> s3AsyncClient.putObject(b -> b.bucket(BUCKET).key(KEY), asyncRequestBody)
.join())
.hasCauseInstanceOf(NonRetryableException.class)
.hasMessageContaining("Multiple subscribers detected.");

verify(1, putRequestedFor(anyUrl()).withQueryParam("partNumber", matching(String.valueOf(1))));
verify(1, putRequestedFor(anyUrl()).withQueryParam("partNumber", matching(String.valueOf(1))));
return;
} catch (AssertionError e) {
if (i == 2) throw e;
}

@Override
public void subscribe(Subscriber<? super ByteBuffer> s) {
Flowable.fromIterable(buffers).subscribe(s);
}
};

assertThatThrownBy(() -> s3AsyncClient.putObject(b -> b.bucket(BUCKET).key(KEY), asyncRequestBody)
.join())
.hasCauseInstanceOf(NonRetryableException.class)
.hasMessageContaining("Multiple subscribers detected.");

verify(1, putRequestedFor(anyUrl()).withQueryParam("partNumber", matching(String.valueOf(1))));
verify(1, putRequestedFor(anyUrl()).withQueryParam("partNumber", matching(String.valueOf(1))));
}
}


Expand Down
Loading