summaryrefslogtreecommitdiff
path: root/tests/integration/test_fullscrape.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_fullscrape.py')
-rw-r--r--tests/integration/test_fullscrape.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/integration/test_fullscrape.py b/tests/integration/test_fullscrape.py
index 3150612..45b3ffb 100644
--- a/tests/integration/test_fullscrape.py
+++ b/tests/integration/test_fullscrape.py
@@ -8,6 +8,7 @@ so these also exercise the chunked transfer the ordinary replies never take.
8 8
9import gzip 9import gzip
10import struct 10import struct
11import time
11import unittest 12import unittest
12 13
13from harness import TrackerTestCase, bdecode 14from harness import TrackerTestCase, bdecode
@@ -78,15 +79,14 @@ class FullScrape(TrackerTestCase):
78 escaped = line.rsplit(b":", 2)[0] 79 escaped = line.rsplit(b":", 2)[0]
79 self.assertIn(b"%", escaped, "these hashes are mostly unprintable bytes") 80 self.assertIn(b"%", escaped, "these hashes are mostly unprintable bytes")
80 81
81 def test_the_state_dump_carries_an_age_rather_than_a_peer_count(self): 82 def test_the_state_dump_carries_a_stamp_rather_than_a_peer_count(self):
82 """What a restart reads back. The second column is how many minutes 83 """What a restart reads back. The second column is the minute the
83 ago the torrent was last touched, not a stamp and not a count of 84 torrent was last touched and not a count of anybody, by the wall
84 anybody: the clock counts from boot, so an absolute time would mean 85 clock, which is the only one two runs of the tracker agree on."""
85 nothing to the process that reads it."""
86 entries = self.entries_from_lines(self.scrape_all("/stats?mode=statedump")) 86 entries = self.entries_from_lines(self.scrape_all("/stats?mode=statedump"))
87 self.assertIn(self.seeding.hex().upper().encode(), entries) 87 self.assertIn(self.seeding.hex().upper().encode(), entries)
88 age, completed = entries[self.seeding.hex().upper().encode()] 88 stamp, completed = entries[self.seeding.hex().upper().encode()]
89 self.assertEqual(int(age), 0, "announced a moment ago") 89 self.assertAlmostEqual(int(stamp), int(time.time()) // 60, delta=1, msg="announced a moment ago")
90 self.assertEqual(int(completed), 0) 90 self.assertEqual(int(completed), 0)
91 91
92 # ------------------------------------------------------------ shape 92 # ------------------------------------------------------------ shape