Given the following test helper method:
def compareDataToFile(Flux<ByteBuffer> data, File file) {
FileInputStream fis = new FileInputStream(file)
for (ByteBuffer received : data.toIterable()) {
byte[] readBuffer = new byte[received.remaining()]
fis.read(readBuffer)
for (int i = 0; i < received.remaining(); i++) {
if (readBuffer[i] != received.get(i)) {
return false
}
}
}
fis.close()
return true
}
being called from a test that downloads a blob and passes the returned Flux in along with the sourceFile that was uploaded produces different results depending on the presence of the @requires( {liveMode()} ) annotation.
For dataSizes over a few MB, the test will consistently fail. More specifically, what appears to happen is that the presence of the annotation causes the items coming from the result of toIterable to be out of order. Small data sizes do not fail because there is only one emission, but anything with more than one emission will fail. The data downloaded is correct (which can be observed by downloading to a file and comparing those results instead). The test behavior changes reliably by toggling the presence of this annotation, but it is not clear why.
Given the following test helper method:
being called from a test that downloads a blob and passes the returned Flux in along with the sourceFile that was uploaded produces different results depending on the presence of the @requires( {liveMode()} ) annotation.
For dataSizes over a few MB, the test will consistently fail. More specifically, what appears to happen is that the presence of the annotation causes the items coming from the result of toIterable to be out of order. Small data sizes do not fail because there is only one emission, but anything with more than one emission will fail. The data downloaded is correct (which can be observed by downloading to a file and comparing those results instead). The test behavior changes reliably by toggling the presence of this annotation, but it is not clear why.