[tor-commits] [stem/master] Skip tests that create HSv3 descriptors

atagar at torproject.org atagar at torproject.org
Sun Nov 17 23:40:39 UTC 2019


commit 97eebb5bb7dc641f06b1b063807256f616062b1c
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Nov 14 17:26:34 2019 -0800

    Skip tests that create HSv3 descriptors
    
    Ooph, slow_ed25519.py warns that this shouldn't be run in production and
    now I see why.
    
    Each blinded key creation and signing takes three seconds, raising our unit
    test runtime from 6s to 51s. This complicates working on this branch so
    disabling these tests until I can sort this out.
    
      % ./run_tests.py --unit --test descriptor.hidden_service_v3 --verbose
    
      ======================================================================
       test.unit.descriptor.hidden_service_v3.TestHiddenServiceDescriptorV3
      ======================================================================
    
      test_address_from_public_key                           0 ms  [SUCCESS]
      test_decryption                                        3 ms  [SUCCESS]
      test_encode_decode_descriptor                         2.94s  [SUCCESS]
      test_inner_layer                                       0 ms  [SUCCESS]
      test_inner_layer_creation                              3 ms  [SUCCESS]
      test_intro_point_creation                              0 ms  [SUCCESS]
      test_intro_point_crypto                                0 ms  [SUCCESS]
      test_intro_point_crypto_without_prereq                 0 ms  [SUCCESS]
      test_intro_point_encode                                0 ms  [SUCCESS]
      test_intro_point_parse                                 0 ms  [SUCCESS]
      test_invalid_lifetime                                 9.05s  [SUCCESS]
      test_invalid_revision_counter                         9.12s  [SUCCESS]
      test_invalid_version                                  8.98s  [SUCCESS]
      test_outer_layer                                       0 ms  [SUCCESS]
      test_outer_layer_creation                              3 ms  [SUCCESS]
      test_public_key_from_address                           0 ms  [SUCCESS]
      test_real_descriptor                                   1 ms  [SUCCESS]
      test_required_fields                                 18.31s  [SUCCESS]
    
      ----------------------------------------------------------------------
---
 test/unit/descriptor/hidden_service_v3.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/unit/descriptor/hidden_service_v3.py b/test/unit/descriptor/hidden_service_v3.py
index 893ef29e..5bfd5cc4 100644
--- a/test/unit/descriptor/hidden_service_v3.py
+++ b/test/unit/descriptor/hidden_service_v3.py
@@ -81,6 +81,16 @@ with open(get_resource('hidden_service_v3_intro_point')) as intro_point_file:
   INTRO_POINT_STR = intro_point_file.read()
 
 
+# TODO: Blinded key creation and signing are horribly slow. 1.5 seconds each,
+# making each call to HiddenServiceDescriptorV3.create() take over three
+# seconds.
+#
+# Obviously we need to address this, but for the moment skipping the slow tests
+# don't slow branch development.
+
+SKIP_SLOW_TESTS = True
+
+
 class TestHiddenServiceDescriptorV3(unittest.TestCase):
   def test_real_descriptor(self):
     """
@@ -168,6 +178,9 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     Check that we require the mandatory fields.
     """
 
+    if SKIP_SLOW_TESTS:
+      return
+
     line_to_attr = {
       'hs-descriptor': 'version',
       'descriptor-lifetime': 'lifetime',
@@ -187,6 +200,9 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     Checks that our version field expects a numeric value.
     """
 
+    if SKIP_SLOW_TESTS:
+      return
+
     test_values = (
       '',
       '-10',
@@ -202,6 +218,9 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     Checks that our lifetime field expects a numeric value.
     """
 
+    if SKIP_SLOW_TESTS:
+      return
+
     test_values = (
       '',
       '-10',
@@ -217,6 +236,9 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     Checks that our revision counter field expects a numeric value.
     """
 
+    if SKIP_SLOW_TESTS:
+      return
+
     test_values = (
       '',
       '-10',
@@ -417,6 +439,9 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     making onion service descriptors.
     """
 
+    if SKIP_SLOW_TESTS:
+      return
+
     from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
     from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
 





More information about the tor-commits mailing list