commit 87b05342286546f603ea4bca2aee68e2b95d875e Author: Damian Johnson atagar@torproject.org Date: Mon Dec 31 00:12:40 2012 -0800
Network status integ tests should check for unrecognized lines
Probably the most useful integration test that we have is the check for unrecognized lines in the server descriptors. That one test has found dozens of upstream tor bugs (mostly new additions without spec updates).
It turns out that we were missing this check for network statuses, and it's already tripping on an issue. Oops. --- test/integ/descriptor/networkstatus.py | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/test/integ/descriptor/networkstatus.py b/test/integ/descriptor/networkstatus.py index 6355220..aa20169 100644 --- a/test/integ/descriptor/networkstatus.py +++ b/test/integ/descriptor/networkstatus.py @@ -50,6 +50,11 @@ class TestNetworkStatus(unittest.TestCase): for flag in router.flags: if not flag in stem.descriptor.Flag: raise ValueError("Unrecognized flag type: %s, found on relay %s (%s)" % (flag, router.fingerprint, router.nickname)) + + unrecognized_lines = router.get_unrecognized_lines() + + if unrecognized_lines: + self.fail("Unrecognized descriptor content: %s" % unrecognized_lines)
# Sanity test that there's at least a hundred relays. If that's not the # case then this probably isn't a real, complete tor consensus. @@ -87,6 +92,11 @@ class TestNetworkStatus(unittest.TestCase): for flag in router.flags: if not flag in stem.descriptor.Flag: raise ValueError("Unrecognized flag type: %s, found on microdescriptor relay %s (%s)" % (flag, router.fingerprint, router.nickname)) + + unrecognized_lines = router.get_unrecognized_lines() + + if unrecognized_lines: + self.fail("Unrecognized descriptor content: %s" % unrecognized_lines)
self.assertTrue(count > 100)