commit 61bd56b61c3c8a26200aee51d3fc7306c18ccf8d Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Sep 28 21:04:28 2016 +0200
Add test for unknown bridge network status lines. --- .../torproject/collector/bridgedescs/SanitizedBridgesWriter.java | 2 +- .../collector/bridgedescs/SanitizedBridgesWriterTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java index 78e32b6..57307d8 100644 --- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java +++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java @@ -541,7 +541,7 @@ public class SanitizedBridgesWriter extends CollecTorMain { || line.startsWith("p ") || line.equals("p")) { scrubbed.append(line + "\n");
- /* There should be nothing else but r, w, p, and s lines in the + /* There should be nothing else but r, a, w, p, and s lines in the * network status. If there is, we should probably learn before * writing anything to the sanitized descriptors. */ } else { diff --git a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java index 6ac6eec..424de8e 100644 --- a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java +++ b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java @@ -587,6 +587,15 @@ public class SanitizedBridgesWriterTest { }
@Test + public void testNetworkStatusVLineUnknown() throws Exception { + this.defaultNetworkStatusBuilder.insertBeforeLineStartingWith("w ", + Arrays.asList("v Tor 0.2.7.6")); + this.runTest(); + assertTrue("Should not have sanitized status with v line which is unknown " + + "in this descriptor type.", this.parsedNetworkStatuses.isEmpty()); + } + + @Test public void testNetworkStatusFromBifroest() throws Exception { this.defaultTarballBuilder.setTarballFileName( this.defaultTarballBuilder.getTarballFileName()
tor-commits@lists.torproject.org