From 323774698ee0a2e80e2f7884784f916a8eaff61a Mon Sep 17 00:00:00 2001 From: david-sarah Date: Sat, 16 Jun 2012 18:18:44 +0000 Subject: [PATCH] Make the intent of the loop over servers in test_system.Connections.test_rref clearer, and able to be the same in 1.9.2 and trunk. Remove the now-unused node_key_s attribute of Client. refs #1636 --- src/allmydata/client.py | 1 - src/allmydata/test/test_system.py | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 239fdc1f..1e4479bb 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -213,7 +213,6 @@ class Client(node.Node, pollmixin.PollMixin): sk,vk_vs = keyutil.parse_privkey(sk_vs.strip()) self.write_config("node.pubkey", vk_vs+"\n") self._server_key = sk - self.node_key_s = vk_vs def _init_permutation_seed(self, ss): seed = self.get_config_from_file("permutation-seed") diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index f69c5f74..b2461ac6 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1887,6 +1887,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): d.addCallback(_got_lit_filenode) return d + class Connections(SystemTestMixin, unittest.TestCase): def test_rref(self): if NormalizedVersion(foolscap.__version__) < NormalizedVersion('0.6.4'): @@ -1897,11 +1898,12 @@ class Connections(SystemTestMixin, unittest.TestCase): d = self.set_up_nodes(2) def _start(ign): self.c0 = self.clients[0] - for s in self.c0.storage_broker.get_connected_servers(): - if "pub-"+s.get_longname() != self.c0.node_key_s: - break - self.s1 = s # s1 is the server, not c0 - self.s1_rref = s.get_rref() + nonclients = [s for s in self.c0.storage_broker.get_connected_servers() + if s.get_serverid() != self.c0.nodeid] + self.failUnlessEqual(len(nonclients), 1) + + self.s1 = nonclients[0] # s1 is the server, not c0 + self.s1_rref = self.s1.get_rref() self.failIfEqual(self.s1_rref, None) self.failUnless(self.s1.is_connected()) d.addCallback(_start) -- 2.37.2