[tor-commits] [metrics-lib/master] Fix unit tests which were broken in 466725e.

karsten at torproject.org karsten at torproject.org
Tue Jun 19 12:41:16 UTC 2012


commit 7348b3d208fb7f1e70a123712792b2561eb4930d
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Jun 19 14:11:34 2012 +0200

    Fix unit tests which were broken in 466725e.
---
 .../descriptor/impl/ServerDescriptorImplTest.java  |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
index a59db3b..264ff13 100644
--- a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
+++ b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
@@ -579,8 +579,20 @@ public class ServerDescriptorImplTest {
   }
 
   @Test(expected = DescriptorParseException.class)
+  public void testBandwidthOneValue() throws DescriptorParseException {
+    DescriptorBuilder.createWithBandwidthLine("bandwidth 51200");
+  }
+
+  @Test()
   public void testBandwidthTwoValues() throws DescriptorParseException {
-    DescriptorBuilder.createWithBandwidthLine("bandwidth 51200 51200");
+    /* This is allowed, because Tor versions 0.0.8 and older only wrote
+     * bandwidth lines with rate and burst values, but no observed
+     * value. */
+    ServerDescriptor descriptor = DescriptorBuilder.
+        createWithBandwidthLine("bandwidth 51200 51200");
+    assertEquals(51200, (int) descriptor.getBandwidthRate());
+    assertEquals(51200, (int) descriptor.getBandwidthBurst());
+    assertEquals(-1, (int) descriptor.getBandwidthObserved());
   }
 
   @Test(expected = DescriptorParseException.class)





More information about the tor-commits mailing list