[tor-commits] [stem/master] Integ test server descriptor downloading
atagar at torproject.org
atagar at torproject.org
Sat Aug 17 20:44:27 UTC 2019
commit cb7147a502d6b2eb51b65540eaeab062bcfdf013
Author: Damian Johnson <atagar at torproject.org>
Date: Mon Aug 5 22:18:07 2019 -0700
Integ test server descriptor downloading
---
test/integ/descriptor/collector.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/integ/descriptor/collector.py b/test/integ/descriptor/collector.py
index 6a0ec5ac..040c6b72 100644
--- a/test/integ/descriptor/collector.py
+++ b/test/integ/descriptor/collector.py
@@ -2,12 +2,16 @@
Integration tests for stem.descriptor.collector.
"""
+import datetime
import unittest
import test.require
+import stem.descriptor.collector
+
from stem.descriptor import Compression
-from stem.descriptor.collector import CollecTor
+
+RECENT = datetime.datetime.utcnow() - datetime.timedelta(minutes = 60)
class TestCollector(unittest.TestCase):
@@ -31,11 +35,20 @@ class TestCollector(unittest.TestCase):
def test_index_lzma(self):
self._test_index(Compression.LZMA)
+ @test.require.only_run_once
+ @test.require.online
+ def test_downloading_server_descriptors(self):
+ recent_descriptors = list(stem.descriptor.collector.get_server_descriptors(start = RECENT))
+
+ if not (300 < len(recent_descriptors) < 800):
+ self.fail('Downloaded %i descriptors, expected 300-800' % len(recent_descriptors)) # 584 on 8/5/19
+
def _test_index(self, compression):
if compression and not compression.available:
self.skipTest('(%s unavailable)' % compression)
+ return
- collector = CollecTor()
+ collector = stem.descriptor.collector.CollecTor()
index = collector.index(compression = compression)
self.assertEqual('https://collector.torproject.org', index['path'])
More information about the tor-commits
mailing list