cameronlee314 commented on a change in pull request #1239: SAMZA-2421: Add
SystemProducer for Azure Blob Storage
URL: https://github.com/apache/samza/pull/1239#discussion_r362685325
##########
File path:
samza-azure/src/test/java/org/apache/samza/system/azureblob/avro/TestAzureBlobOutputStream.java
##########
@@ -124,11 +126,10 @@ public void testWriteLargerThanThreshold() {
verify(mockCompression).compress(largeRecordFirstHalf);
verify(mockCompression).compress(largeRecordSecondHalf);
ArgumentCaptor<Flux> argument = ArgumentCaptor.forClass(Flux.class);
- verify(mockBlobAsyncClient).stageBlock(eq(blockIdEncoded(0)),
argument.capture(), eq((long) compressB.length));
- verify(mockBlobAsyncClient).stageBlock(eq(blockIdEncoded(1)),
argument.capture(), eq((long) compressB.length));
- argument.getAllValues().forEach(flux -> {
- Assert.assertEquals(ByteBuffer.wrap(compressB), flux.blockFirst());
- });
+ verify(mockBlobAsyncClient).stageBlock(eq(blockIdEncoded(0)),
argument.capture(), eq((long) compressB1.length));
+ verify(mockBlobAsyncClient).stageBlock(eq(blockIdEncoded(1)),
argument.capture(), eq((long) compressB2.length));
+ Assert.assertEquals(ByteBuffer.wrap(compressB1),
argument.getAllValues().get(0).blockFirst());
+ Assert.assertEquals(ByteBuffer.wrap(compressB2),
argument.getAllValues().get(1).blockFirst());
Review comment:
It is my understanding that `stageBlock` is part of the async flow.
Therefore, it might be possible that `stageBlock` for `blockIdEncoded(1)` is
called before `blockIdEncoded(0)`. I think that would mean that the values in
the argument captor could be in the other order. To be more stable, you can
have a separate argument captor for block 0 and block 1, and each captor will
just have a single value.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services