Replace the hard-coded 522-bit RSA key size used for tests with a TEST_RSA_KEY_SIZE...
authordavid-sarah <david-sarah@jacaranda.org>
Wed, 10 Aug 2011 20:22:43 +0000 (13:22 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Wed, 10 Aug 2011 20:22:43 +0000 (13:22 -0700)
src/allmydata/client.py
src/allmydata/test/common.py
src/allmydata/test/no_network.py
src/allmydata/test/test_keygen.py
src/allmydata/test/test_mutable.py

index 46eb3c0928a26fe8abbfa206533f3d62f76527cf..3cb4cd66644722480529311ebae93c9d7a151696 100644 (file)
@@ -69,14 +69,14 @@ class KeyGenerator:
         mutable files which don't otherwise specify a size. This will affect
         all subsequent calls to generate() without a keysize= argument. The
         default size is 2048 bits. Test cases should call this method once
-        during setup, to cause me to create smaller (522 bit) keys, so the
-        unit tests run faster."""
+        during setup, to cause me to create smaller keys, so the unit tests
+        run faster."""
         self.default_keysize = keysize
 
     def generate(self, keysize=None):
         """I return a Deferred that fires with a (verifyingkey, signingkey)
-        pair. I accept a keysize in bits (522 bit keys are fast for testing,
-        2048 bit keys are standard). If you do not provide a keysize, I will
+        pair. I accept a keysize in bits (2048 bit keys are standard, smaller
+        keys are used for testing). If you do not provide a keysize, I will
         use my default, which is set by a call to set_default_keysize(). If
         set_default_keysize() has never been called, I will create 2048 bit
         keys."""
index 33678a004a44984db5e8c7ac5245834b0c6fc7f9..d728bcb068266107ca4741ead6e698150c6a8594 100644 (file)
@@ -539,7 +539,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
 
         self.key_generator_svc = KeyGeneratorService(kgsdir,
                                                      display_furl=False,
-                                                     default_key_size=522)
+                                                     default_key_size=TEST_RSA_KEY_SIZE)
         self.key_generator_svc.key_generator.pool_size = 4
         self.key_generator_svc.key_generator.pool_refresh_delay = 60
         self.add_service(self.key_generator_svc)
@@ -599,7 +599,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
         # will have registered the helper furl).
         c = self.add_service(client.Client(basedir=basedirs[0]))
         self.clients.append(c)
-        c.set_default_mutable_keysize(522)
+        c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
         d = c.when_tub_ready()
         def _ready(res):
             f = open(os.path.join(basedirs[0],"private","helper.furl"), "r")
@@ -617,7 +617,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
             for i in range(1, self.numclients):
                 c = self.add_service(client.Client(basedir=basedirs[i]))
                 self.clients.append(c)
-                c.set_default_mutable_keysize(522)
+                c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
             log.msg("STARTING")
             return self.wait_for_connections()
         d.addCallback(_ready)
@@ -650,7 +650,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
         def _stopped(res):
             new_c = client.Client(basedir=self.getdir("client%d" % num))
             self.clients[num] = new_c
-            new_c.set_default_mutable_keysize(522)
+            new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
             self.add_service(new_c)
             return new_c.when_tub_ready()
         d.addCallback(_stopped)
@@ -678,7 +678,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
 
         c = client.Client(basedir=basedir)
         self.clients.append(c)
-        c.set_default_mutable_keysize(522)
+        c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
         self.numclients += 1
         if add_to_sparent:
             c.setServiceParent(self.sparent)
index 535cac1f187e21b5ef0c4ba396fd86137f055a3d..4730a952601dd306a6aa0251c2e67aab6598202f 100644 (file)
@@ -236,7 +236,7 @@ class NoNetworkGrid(service.MultiService):
                 c = client_config_hooks[i](clientdir)
             if not c:
                 c = NoNetworkClient(clientdir)
-                c.set_default_mutable_keysize(522)
+                c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
             c.nodeid = clientid
             c.short_nodeid = b32encode(clientid).lower()[:8]
             c._servers = self.all_servers # can be updated later
index 45fbaea2220ce77ff7ee8e4a777f5ef335b98f12..c282a888291937dfe01156055b1ff201a49fa676 100644 (file)
@@ -41,7 +41,7 @@ class KeyGenService(unittest.TestCase, pollmixin.PollMixin):
             return junk
 
         #print 'starting key generator service'
-        keysize = 522
+        keysize = TEST_RSA_KEY_SIZE
         kgs = key_generator.KeyGeneratorService(display_furl=False, default_key_size=keysize)
         kgs.key_generator.verbose = True
         kgs.setServiceParent(self.parent)
index 5113a5dbd01487003565d996d30b34a5ece8dee6..1ef424da95674a82a2ee2d17262433ee498f9f07 100644 (file)
@@ -228,7 +228,7 @@ def make_nodemaker(s=None, num_peers=10):
     storage_broker = make_storagebroker(s, num_peers)
     sh = client.SecretHolder("lease secret", "convergence secret")
     keygen = client.KeyGenerator()
-    keygen.set_default_keysize(522)
+    keygen.set_default_keysize(TEST_RSA_KEY_SIZE)
     nodemaker = NodeMaker(storage_broker, sh, None,
                           None, None,
                           {"k": 3, "n": 10}, keygen)
@@ -2600,7 +2600,7 @@ class Problems(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
         # use #467 static-server-selection to disable permutation and force
         # the choice of server for share[0].
 
-        d = nm.key_generator.generate(522)
+        d = nm.key_generator.generate(TEST_RSA_KEY_SIZE)
         def _got_key( (pubkey, privkey) ):
             nm.key_generator = SameKeyGenerator(pubkey, privkey)
             pubkey_s = pubkey.serialize()