commit 4b3c2fef58363c7135bad21a883e9f17a57d001a Author: iwakeh iwakeh@torproject.org Date: Wed Jul 12 18:47:46 2017 +0000
Adapt and add tests for OnionPerf sync-runs. --- .../java/org/torproject/collector/conf/ConfigurationTest.java | 2 +- .../java/org/torproject/collector/sync/SyncPersistenceTest.java | 9 ++++++++- src/test/resources/op-nl-1048576-2017-04-11.tpf | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/torproject/collector/conf/ConfigurationTest.java b/src/test/java/org/torproject/collector/conf/ConfigurationTest.java index bbe7832..634bca5 100644 --- a/src/test/java/org/torproject/collector/conf/ConfigurationTest.java +++ b/src/test/java/org/torproject/collector/conf/ConfigurationTest.java @@ -40,7 +40,7 @@ public class ConfigurationTest { public void testKeyCount() throws Exception { assertEquals("The number of properties keys in enum Key changed." + "\n This test class should be adapted.", - 44, Key.values().length); + 45, Key.values().length); }
@Test() diff --git a/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java b/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java index fe47f26..f0d30bc 100644 --- a/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java +++ b/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java @@ -43,6 +43,12 @@ public class SyncPersistenceTest { Integer.valueOf(1), // expected recent count of descs files Integer.valueOf(1)}, // expected output count of descs files
+ {"torperf/op-nl-1048576-2017-04-11.tpf", + new String[]{"torperf/2017/04/11/op-nl-1048576-2017-04-11.tpf"}, + "op-nl-1048576-2017-04-11.tpf", + Integer.valueOf(1), + Integer.valueOf(1)}, + {"relay-descriptors/server-descriptors/" + "2016-10-05-19-06-17-server-descriptors", new String[]{"relay-descriptors/server-descriptor/2016/10/e/3/" @@ -273,8 +279,9 @@ public class SyncPersistenceTest { List<String> content = Files.readAllLines(recentList.get(0).toPath(), StandardCharsets.UTF_8); List<String> expContent = linesFromResource(filename); - assertEquals(expContent.size(), content.size()); int contentSize = content.size(); + assertEquals("Number of lines incorrect for file '" + filename + "': " + + content, expContent.size(), contentSize); for (String line : expContent) { assertTrue("Couln't remove " + line + " from " + recentList.get(0), content.remove(line)); diff --git a/src/test/resources/op-nl-1048576-2017-04-11.tpf b/src/test/resources/op-nl-1048576-2017-04-11.tpf new file mode 100644 index 0000000..2396c2e --- /dev/null +++ b/src/test/resources/op-nl-1048576-2017-04-11.tpf @@ -0,0 +1,8 @@ +@type torperf 1.1 +BUILDTIMES=0.150000095367,0.230000019073,0.319999933243 CIRC_ID=664 CONNECT=1491891870.51 DATACOMPLETE=1491891877.51 DATAPERC0=1491891873.58 DATAPERC10=1491891874.32 DATAPERC100=1491891877.51 DATAPERC20=1491891874.68 DATAPERC30=1491891874.94 DATAPERC40=1491891875.37 DATAPERC50=1491891875.60 DATAPERC60=1491891875.95 DATAPERC70=1491891876.29 DATAPERC80=1491891876.68 DATAPERC90=1491891876.96 DATAREQUEST=1491891873.04 DATARESPONSE=1491891873.58 DIDTIMEOUT=0 ENDPOINTLOCAL=localhost:127.0.0.1:48934 ENDPOINTPROXY=localhost:127.0.0.1:43531 ENDPOINTREMOTE=5klxwn5wiwnd4xkm.onion:0.0.0.0:80 FILESIZE=1048576 HOSTNAMELOCAL=op-nl HOSTNAMEREMOTE=op-nl LAUNCH=1491891573.04 NEGOTIATE=1491891870.52 PATH=$34068126B7A8CE0247FA89A2F72F6C4A4DDD8F17,$3A6A156A01891A13DFAB19A16D2DBABB84F1869B,$75D4656446FE6625B6B773DA1E45222A902E3E8B QUANTILE=0.8 READBYTES=1048644 REQUEST=1491891870.52 RESPONSE=1491891873.04 SOCKET=1491891870.51 SOURCE=op-nl SOURCEADDRESS=unknown START=1491891870.51 TIMEOUT=1500 USED_AT=149 1891877.63 USED_BY=1406 WRITEBYTES=54 +@type torperf 1.1 +BUILDTIMES=0.0499999523163,0.0699999332428,0.120000123978 CIRC_ID=669 CONNECT=1491893670.52 DATACOMPLETE=1491893673.18 DATAPERC0=1491893671.99 DATAPERC10=1491893672.22 DATAPERC100=1491893673.18 DATAPERC20=1491893672.36 DATAPERC30=1491893672.45 DATAPERC40=1491893672.55 DATAPERC50=1491893672.65 DATAPERC60=1491893672.76 DATAPERC70=1491893672.87 DATAPERC80=1491893672.90 DATAPERC90=1491893673.06 DATAREQUEST=1491893671.83 DATARESPONSE=1491893671.99 DIDTIMEOUT=0 ENDPOINTLOCAL=localhost:127.0.0.1:49000 ENDPOINTPROXY=localhost:127.0.0.1:43531 ENDPOINTREMOTE=5klxwn5wiwnd4xkm.onion:0.0.0.0:80 FILESIZE=1048576 HOSTNAMELOCAL=op-nl HOSTNAMEREMOTE=op-nl LAUNCH=1491891871.04 NEGOTIATE=1491893670.52 PATH=$766A343C7623BE12976DDE361E47A3FD15C24ED9,$4FA9D001ED3BB02717C419DCC11644F2F2B2A592,$931BE618172446D534478988C01EE1CBD1874A97 QUANTILE=0.8 READBYTES=1048644 REQUEST=1491893670.52 RESPONSE=1491893671.83 SOCKET=1491893670.52 SOURCE=op-nl SOURCEADDRESS=unknown START=1491893670.52 TIMEOUT=1500 USED_AT=1 491893673.24 USED_BY=1436 WRITEBYTES=54 +@type torperf 1.1 +BUILDTIMES=0.00999999046326,0.039999961853,0.0799999237061 CIRC_ID=961 CONNECT=1491926070.57 DATACOMPLETE=1491926078.34 DATAPERC0=1491926072.18 DATAPERC10=1491926073.54 DATAPERC100=1491926078.34 DATAPERC20=1491926074.80 DATAPERC30=1491926075.81 DATAPERC40=1491926076.39 DATAPERC50=1491926076.85 DATAPERC60=1491926077.18 DATAPERC70=1491926077.53 DATAPERC80=1491926077.75 DATAPERC90=1491926077.97 DATAREQUEST=1491926071.80 DATARESPONSE=1491926072.18 DIDTIMEOUT=0 ENDPOINTLOCAL=localhost:127.0.0.1:50180 ENDPOINTPROXY=localhost:127.0.0.1:43531 ENDPOINTREMOTE=5klxwn5wiwnd4xkm.onion:0.0.0.0:80 FILESIZE=1048576 HOSTNAMELOCAL=op-nl HOSTNAMEREMOTE=op-nl LAUNCH=1491925174.04 NEGOTIATE=1491926070.57 PATH=$1A0AD1B2BAE9FEC4970186692B556B4BB7C57B3B,$86C281AD135058238D7A337D546C902BE8505DDE,$F1A98CA0FA1B3DE0AD71B97A6F5003A6BACA9FEB QUANTILE=0.8 READBYTES=1048644 REQUEST=1491926070.58 RESPONSE=1491926071.80 SOCKET=1491926070.57 SOURCE=op-nl SOURCEADDRESS=unknown START=1491926070.57 TIMEOUT=1500 USED_AT= 1491926078.4 USED_BY=2002 WRITEBYTES=54 +@type torperf 1.1 +BUILDTIMES=0.210000038147,0.299999952316,0.55999994278 CIRC_ID=888 CONNECT=1491916770.56 DATACOMPLETE=1491916773.22 DATAPERC0=1491916771.17 DATAPERC10=1491916771.44 DATAPERC100=1491916773.22 DATAPERC20=1491916771.71 DATAPERC30=1491916771.88 DATAPERC40=1491916772.05 DATAPERC50=1491916772.22 DATAPERC60=1491916772.44 DATAPERC70=1491916772.61 DATAPERC80=1491916772.78 DATAPERC90=1491916773.02 DATAREQUEST=1491916770.85 DATARESPONSE=1491916771.17 DIDTIMEOUT=0 ENDPOINTLOCAL=localhost:127.0.0.1:49868 ENDPOINTPROXY=localhost:127.0.0.1:43531 ENDPOINTREMOTE=37.218.247.40:37.218.247.40:80 FILESIZE=1048576 HOSTNAMELOCAL=op-nl HOSTNAMEREMOTE=op-nl LAUNCH=1491916530.04 NEGOTIATE=1491916770.56 PATH=$9E978553A45A53CDDCAEE81FCD5F6878CC920B2F,$0C9B3C686421C5A8C20BAA0D7369CD929F43A174,$DD808ECE4F2E24F377CBE11E335ECDA196FE3B78 QUANTILE=0.8 READBYTES=1048644 REQUEST=1491916770.56 RESPONSE=1491916770.85 SOCKET=1491916770.56 SOURCE=op-nl SOURCEADDRESS=unknown START=1491916770.56 TIMEOUT=1500 USED_AT=1491916 773.23 USED_BY=1854 WRITEBYTES=54
tor-commits@lists.torproject.org