mirror of
https://github.com/torproject/metrics-lib.git
synced 2025-02-14 14:28:52 +00:00
Add tests for published lines containing milliseconds.
Milliseconds are simply ignored, because SimpleDateFormat only looks at "yyyy-MM-dd HH:mm:ss" and ignores everything after that. Related to #9286 where we discovered that some relays include milliseconds in their descriptors.
This commit is contained in:
parent
60a066a0b0
commit
008781b7e5
@ -804,6 +804,13 @@ public class ExtraInfoDescriptorImplTest {
|
||||
assertEquals(1328951316000L, descriptor.getPublishedMillis());
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testPublishedMillis() throws DescriptorParseException {
|
||||
ExtraInfoDescriptor descriptor = DescriptorBuilder.
|
||||
createWithPublishedLine("opt published 2012-02-11 09:08:36.123");
|
||||
assertEquals(1328951316000L, descriptor.getPublishedMillis());
|
||||
}
|
||||
|
||||
@Test(expected = DescriptorParseException.class)
|
||||
public void testWriteHistoryNegativeBytes()
|
||||
throws DescriptorParseException {
|
||||
|
@ -537,6 +537,13 @@ public class ServerDescriptorImplTest {
|
||||
DescriptorBuilder.createWithPublishedLine("published 2012-01-01");
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testPublishedMillis() throws DescriptorParseException {
|
||||
ServerDescriptor descriptor = DescriptorBuilder.
|
||||
createWithPublishedLine("opt published 2012-01-01 04:03:19.123");
|
||||
assertEquals(1325390599000L, descriptor.getPublishedMillis());
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testFingerprintNoOpt() throws DescriptorParseException {
|
||||
ServerDescriptor descriptor = DescriptorBuilder.
|
||||
|
Loading…
x
Reference in New Issue
Block a user