NicoK commented on a change in pull request #6705: [FLINK-10356][network] add sanity checks to SpillingAdaptiveSpanningRecordDeserializer URL: https://github.com/apache/flink/pull/6705#discussion_r252346869
########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/util/DeserializationUtils.java ########## @@ -36,18 +40,25 @@ * * @param records records to be deserialized * @param deserializer the record deserializer + * @param mustBeFullRecords if set, fails if the deserialized records contain partial records * @return the number of full deserialized records */ public static int deserializeRecords( ArrayDeque<SerializationTestType> records, - RecordDeserializer<SerializationTestType> deserializer) throws Exception { + RecordDeserializer<SerializationTestType> deserializer, + boolean mustBeFullRecords) throws Exception { int deserializedRecords = 0; while (!records.isEmpty()) { SerializationTestType expected = records.poll(); SerializationTestType actual = expected.getClass().newInstance(); - if (deserializer.getNextRecord(actual).isFullRecord()) { + RecordDeserializer.DeserializationResult deserializationResult = + deserializer.getNextRecord(actual); + if (mustBeFullRecords) { + assertThat(deserializationResult, hasProperty("fullRecord", equalTo(true))); Review comment: (Slightly) better context: ``` java.lang.AssertionError: Expected: hasProperty("fullRecord", <true>) but: property 'fullRecord' was <false> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.apache.flink.runtime.io.network.util.DeserializationUtils.deserializeRecords(DeserializationUtils.java:61) ``` vs. ``` java.lang.AssertionError at org.junit.Assert.fail(Assert.java:86) at org.junit.Assert.assertTrue(Assert.java:41) at org.junit.Assert.assertTrue(Assert.java:52) at org.apache.flink.runtime.io.network.util.DeserializationUtils.deserializeRecords(DeserializationUtils.java:61) ``` This sometimes allows faster debugging because for some things you don't have to click into the source to know what actually failed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services