[tor-commits] [stem/master] Resume 'GETINFO status/fresh-relay-descs' test

atagar at torproject.org atagar at torproject.org
Sun Jan 5 21:39:28 UTC 2020


commit 4e21371e88662992fa21bc1f845c05c16ccee4f4
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 3 15:55:42 2020 -0800

    Resume 'GETINFO status/fresh-relay-descs' test
    
    To work around these failures Nick suggested adding an Address line to our
    torrc...
    
      https://trac.torproject.org/projects/tor/ticket/32873
    
    Specifying localhost ('Address 127.0.0.1') didn't work, but anecdotally seems
    as though supplying a dummy address like this does.
    
    This reverts commit 983afa8a67e8ef013ff8c03afbd75d0219ea1188.
---
 test/integ/control/controller.py | 22 ++++++++++++++++++++++
 test/settings.cfg                |  1 +
 2 files changed, 23 insertions(+)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 428f516e..a32f66f0 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -256,6 +256,28 @@ class TestController(unittest.TestCase):
       self.assertEqual({}, controller.get_info([], {}))
 
   @test.require.controller
+  def test_getinfo_freshrelaydescs(self):
+    """
+    Exercises 'GETINFO status/fresh-relay-descs'.
+    """
+
+    with test.runner.get_runner().get_tor_controller() as controller:
+      response = controller.get_info('status/fresh-relay-descs')
+      div = response.find('\nextra-info ')
+      nickname = controller.get_conf('Nickname')
+
+      if div == -1:
+        self.fail('GETINFO response should have both a server and extrainfo descriptor:\n%s' % response)
+
+      server_desc = stem.descriptor.server_descriptor.ServerDescriptor(response[:div], validate = True)
+      extrainfo_desc = stem.descriptor.extrainfo_descriptor.ExtraInfoDescriptor(response[div:], validate = True)
+
+      self.assertEqual(nickname, server_desc.nickname)
+      self.assertEqual(nickname, extrainfo_desc.nickname)
+      self.assertEqual(controller.get_info('address'), server_desc.address)
+      self.assertEqual(test.runner.ORPORT, server_desc.or_port)
+
+  @test.require.controller
   @test.require.online
   def test_getinfo_dir_status(self):
     """
diff --git a/test/settings.cfg b/test/settings.cfg
index 2c18110f..9c746234 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -25,6 +25,7 @@ integ.torrc
 |SocksPort [SOCKS_PORT]
 |ORPort [OR_PORT]
 |
+|Address 1.2.3.4
 |DataDirectory [DATA_DIR]
 |Log notice stdout
 |Log debug file [DATA_DIR]/tor_log





More information about the tor-commits mailing list