Skip to content

Commit

Permalink
test(retry): fix 48 and 114 (#1084)
Browse files Browse the repository at this point in the history
com.google.cloud.storage.Storage.create(com.google.cloud.storage.BlobInfo, java.io.InputStream, com.google.cloud.storage.Storage.BlobWriteOption...) is never safe to retry as it does not wrap the inputstream provided to allow it to be safely read multiple times

Fixes #1083
  • Loading branch information
BenWhitehead committed Oct 7, 2021
1 parent df2251a commit 2c4e6c1
Showing 1 changed file with 20 additions and 22 deletions.
Expand Up @@ -1477,19 +1477,18 @@ private static void insert(ArrayList<RpcMethodMapping> a) {
.build());
a.add(
RpcMethodMapping.newBuilder(48, objects.insert)
.withApplicable(TestRetryConformance::isPreconditionsProvided)
.withApplicable(not(TestRetryConformance::isPreconditionsProvided))
.withSetup(defaultSetup.andThen(blobInfoWithGenerationZero))
.withTest(
blobInfoWithGenerationZero.andThen(
(ctx, c) ->
ctx.map(
state ->
state.with(
ctx.getStorage()
.create(
ctx.getState().getBlobInfo(),
new ByteArrayInputStream(
c.getHelloWorldUtf8Bytes()),
BlobWriteOption.generationMatch())))))
(ctx, c) ->
ctx.map(
state ->
state.with(
ctx.getStorage()
.create(
ctx.getState().getBlobInfo(),
new ByteArrayInputStream(c.getHelloWorldUtf8Bytes()),
BlobWriteOption.generationMatch()))))
.build());
a.add(
RpcMethodMapping.newBuilder(49, objects.insert)
Expand Down Expand Up @@ -1717,17 +1716,16 @@ private static void insert(ArrayList<RpcMethodMapping> a) {
a.add(
RpcMethodMapping.newBuilder(114, objects.insert)
.withApplicable(not(TestRetryConformance::isPreconditionsProvided))
.withSetup(defaultSetup.andThen(blobInfoWithoutGeneration))
.withTest(
blobInfoWithoutGeneration.andThen(
(ctx, c) ->
ctx.map(
state ->
state.with(
ctx.getStorage()
.create(
ctx.getState().getBlobInfo(),
new ByteArrayInputStream(
c.getHelloWorldUtf8Bytes()))))))
(ctx, c) ->
ctx.map(
state ->
state.with(
ctx.getStorage()
.create(
ctx.getState().getBlobInfo(),
new ByteArrayInputStream(c.getHelloWorldUtf8Bytes())))))
.build());
a.add(
RpcMethodMapping.newBuilder(115, objects.insert)
Expand Down

0 comments on commit 2c4e6c1

Please sign in to comment.