[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Add test cases for BUILDTIMEOUT_SET events
commit 48daff039d95d8223ecd83cbd3af59a2ee00dc37
Author: Sean Robinson <seankrobinson@xxxxxxxxx>
Date: Fri Dec 14 14:58:08 2012 -0700
Add test cases for BUILDTIMEOUT_SET events
Check integer and float conversion failures raise a ProtocolError.
Signed-off-by: Sean Robinson <seankrobinson@xxxxxxxxx>
---
test/unit/response/events.py | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/test/unit/response/events.py b/test/unit/response/events.py
index 595ae8c..18ce4bd 100644
--- a/test/unit/response/events.py
+++ b/test/unit/response/events.py
@@ -36,6 +36,26 @@ TIMEOUT_RATE=0.137097 \
CLOSE_MS=21850 \
CLOSE_RATE=0.072581"
+BUILD_TIMEOUT_EVENT_BAD_1 = "650 BUILDTIMEOUT_SET COMPUTED \
+TOTAL_TIMES=one_twenty_four \
+TIMEOUT_MS=9019 \
+XM=1375 \
+ALPHA=0.855662 \
+CUTOFF_QUANTILE=0.800000 \
+TIMEOUT_RATE=0.137097 \
+CLOSE_MS=21850 \
+CLOSE_RATE=0.072581"
+
+BUILD_TIMEOUT_EVENT_BAD_2 = "650 BUILDTIMEOUT_SET COMPUTED \
+TOTAL_TIMES=124 \
+TIMEOUT_MS=9019 \
+XM=1375 \
+ALPHA=0.855662 \
+CUTOFF_QUANTILE=zero_point_eight \
+TIMEOUT_RATE=0.137097 \
+CLOSE_MS=21850 \
+CLOSE_RATE=0.072581"
+
# CIRC events from tor v0.2.3.16
CIRC_LAUNCHED = "650 CIRC 7 LAUNCHED \
@@ -316,6 +336,9 @@ class TestEvents(unittest.TestCase):
self.assertEqual(0.137097, event.timeout_rate)
self.assertEqual(21850, event.close_timeout)
self.assertEqual(0.072581, event.close_rate)
+
+ self.assertRaises(ProtocolError, _get_event, BUILD_TIMEOUT_EVENT_BAD_1)
+ self.assertRaises(ProtocolError, _get_event, BUILD_TIMEOUT_EVENT_BAD_2)
def test_bw_event(self):
event = _get_event("650 BW 15 25")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits