Fix Flight integration tests using metadata

This commit is contained in:
David Li committed 2019-06-26 09:25:14 -04:00
1 parent eff22393c0
commit 85e21699c4
3 files changed
+5 -4

No files matched your search

@@ -307,7 +307,8 @@ class ArrowMessage implements AutoCloseable {
cos.writeBytes(FlightData.DATA_HEADER_FIELD_NUMBER, bytes);
if (appMetadata != null && appMetadata.capacity() > 0) {
cos.writeByteBuffer(FlightData.APP_METADATA_FIELD_NUMBER, appMetadata.asNettyBuffer().nioBuffer());
// Must call slice() as CodedOutputStream#writeByteBuffer writes -capacity- bytes, not -limit- bytes
cos.writeByteBuffer(FlightData.APP_METADATA_FIELD_NUMBER, appMetadata.asNettyBuffer().nioBuffer().slice());
// This is weird, but implicitly, writing an ArrowMessage frees any references it has
appMetadata.getReferenceManager().release();
}
@@ -109,8 +109,9 @@ class IntegrationTestClient {
@Override
public void onNext(PutResult val) {
final String metadata = StandardCharsets.UTF_8.decode(val.getApplicationMetadata().nioBuffer())
.toString();
final byte[] metadataRaw = new byte[val.getApplicationMetadata().readableBytes()];
val.getApplicationMetadata().readBytes(metadataRaw);
final String metadata = new String(metadataRaw, StandardCharsets.UTF_8);
if (!Integer.toString(counter).equals(metadata)) {
throw new RuntimeException(
String.format("Invalid ACK from server. Expected '%d' but got '%s'.", counter, metadata));
-1
View File
@@ -28,7 +28,6 @@ import time
import traceback
import pytest
import pyarrow as pa
from pyarrow.compat import tobytes