[metrics-bugs] #16513 [Metrics/Onionoo]: Make writing of the out/ directory from the status/ directory deterministic
Tor Bug Tracker & Wiki
blackhole at torproject.org
Thu Jan 11 15:49:20 UTC 2018
#16513: Make writing of the out/ directory from the status/ directory deterministic
-----------------------------+-------------------------------
Reporter: karsten | Owner: metrics-team
Type: enhancement | Status: merge_ready
Priority: High | Milestone: Onionoo-2.0.0
Component: Metrics/Onionoo | Version:
Severity: Normal | Resolution:
Keywords: metrics-2018 | Actual Points:
Parent ID: | Points:
Reviewer: iwakeh | Sponsor:
-----------------------------+-------------------------------
Changes (by iwakeh):
* status: needs_review => merge_ready
Comment:
Replying to [comment:23 karsten]:
> I renamed `now` to `lastSeenMillis` in
[https://gitweb.torproject.org/user/karsten/onionoo.git/commit/?h=task-16513-2&id=27794f7a7500783cd4b8f47f857b5e59c3c3fe61
commit 27794f7], and I realized that we'll have to make similar changes to
updating status which I did in
[https://gitweb.torproject.org/user/karsten/onionoo.git/commit/?h=task-16513-2&id=7e99b95485529c6a1d22ef7ee0eff841a890a598
commit 7e99b95]. Please take another look at least at that second commit.
Good that you thought of this!
When taking another look at the tests, I'd say it's time to start using
new DateTime classes. For example:
{{{
diff --git
a/src/test/java/org/torproject/onionoo/docs/WeightsStatusTest.java
b/src/test/java/org/torproject/onionoo/docs/WeightsStatusTest.java
index e28f989..7169aaa 100644
--- a/src/test/java/org/torproject/onionoo/docs/WeightsStatusTest.java
+++ b/src/test/java/org/torproject/onionoo/docs/WeightsStatusTest.java
@@ -9,6 +9,8 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import java.time.ZoneOffset;
+import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Map;
import java.util.SortedMap;
@@ -101,7 +103,8 @@ public class WeightsStatusTest {
}
assertEquals("history: ", correctHistory,
mapToString(ws.getHistory()));
assertEquals(correctLines.length, ws.getHistory().size());
- ws.compressHistory(1515670935476L);
+ ws.compressHistory(LocalDateTime.of(2017, 01, 01, 7, 15, 0, 0)
+ .toInstant(ZoneOffset.UTC).toEpochMilli());
assertEquals("found: " + mapToString(ws.getHistory()), 1,
ws.getHistory().size());
assertEquals("[1431032400000, 1431043200000] : [-1.0, 1.78279826E-4,
"
}}}
This is a bit longer, but will make the tests more readable and it will be
immediately obvious what timestamp is used in a test. Maybe, start at
least with the newly introduced tests here?
>
> Right now I'm downloading omeiense's `status/` and `out/` directories
and will run a local Onionoo server for a few hours, just to be really
sure that it's doing the right thing.
Tests and checks pass. Ready for merge when the system test succeeds.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16513#comment:24>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the metrics-bugs
mailing list