Commit 3feeae10 authored by Iain Learmonth's avatar Iain Learmonth
Browse files

Adds simple test for OnionPerf schema v3.1

This test only ensures that the new fields do
not cause the parser to crash, it does not look
at actually parsing those fields.

Fixes: #40003
parent c4453432
Pipeline #5115 passed with stage
in 3 minutes and 8 seconds
......@@ -180,5 +180,24 @@ public class OnionPerfAnalysisConverterTest {
}
assertTrue(expectedTorperfResults.isEmpty());
}
}
@Test
public void testDoesNotCrashVersion31() throws IOException,
DescriptorParseException {
URL resouce = getClass().getClassLoader().getResource(
"onionperf/v3.1.onionperf.analysis.json.xz");
assertNotNull(resouce);
InputStream compressedInputStream = resouce.openStream();
assertNotNull(compressedInputStream);
byte[] rawDescriptorBytes = IOUtils.toByteArray(compressedInputStream);
OnionPerfAnalysisConverter onionPerfAnalysisConverter
= new OnionPerfAnalysisConverter(rawDescriptorBytes, null);
for (Descriptor descriptor
: onionPerfAnalysisConverter.asTorperfResults()) {
assertTrue(descriptor instanceof TorperfResult);
String formattedTorperfResult
= new String(descriptor.getRawDescriptorBytes()).trim();
assertNotNull(formattedTorperfResult);
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment