From 63538345f21f1b8931fc9a8a37bdcbe51943c392 Mon Sep 17 00:00:00 2001 From: Chuck Thier Date: Mon, 19 Jul 2010 03:00:28 +0000 Subject: [PATCH 1/2] Modified probe tests to work with setup.py develop installs Updated SAIO instructions to note that probe tests will reset your environment Added the swift.egg-info directory to .bzrignore --- .bzrignore | 1 + doc/source/development_saio.rst | 6 +++--- test/probe/common.py | 12 +++++------ test/probe/test_account_failures.py | 4 ++-- test/probe/test_container_failures.py | 8 ++++---- test/probe/test_object_async_update.py | 4 ++-- test/probe/test_object_handoff.py | 20 +++++++++---------- .../probe/test_running_with_each_type_down.py | 6 +++--- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.bzrignore b/.bzrignore index 57b544d231..12fc9b2393 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,3 +1,4 @@ *.py[co] *.sw? doc/build/* +swift.egg-info diff --git a/doc/source/development_saio.rst b/doc/source/development_saio.rst index 015741e023..88fd423c8f 100644 --- a/doc/source/development_saio.rst +++ b/doc/source/development_saio.rst @@ -443,13 +443,13 @@ good idea what to do on other environments. collate = C #. `cd ~/swift/trunk; ./.functests` - #. `cd ~/swift/trunk; ./.probetests` + #. `cd ~/swift/trunk; ./.probetests` (Note for future reference: probe tests + will reset your environment) If you plan to work on documentation (and who doesn't?!): #. `sudo apt-get install python-sphinx` - #. `cd ~/swift/doc` - #. `make html` + #. `python setup.py build_sphinx` ---------------- Debugging Issues diff --git a/test/probe/common.py b/test/probe/common.py index 8465782f0c..de41ae6e21 100644 --- a/test/probe/common.py +++ b/test/probe/common.py @@ -35,15 +35,15 @@ def reset_environment(): call(['resetswift']) pids = {} try: - pids['auth'] = Popen(['/usr/bin/swift-auth-server', + pids['auth'] = Popen(['swift-auth-server', '/etc/swift/auth-server.conf']).pid - pids['proxy'] = Popen(['/usr/bin/swift-proxy-server', + pids['proxy'] = Popen(['swift-proxy-server', '/etc/swift/proxy-server.conf']).pid port2server = {} for s, p in (('account', 6002), ('container', 6001), ('object', 6000)): for n in xrange(1, 5): pids['%s%d' % (s, n)] = \ - Popen(['/usr/bin/swift-%s-server' % s, + Popen(['swift-%s-server' % s, '/etc/swift/%s-server/%d.conf' % (s, n)]).pid port2server[p + (n * 10)] = '%s%d' % (s, n) account_ring = Ring('/etc/swift/account.ring.gz') @@ -69,7 +69,7 @@ def get_to_final_state(): for job in ('account-replicator', 'container-replicator', 'object-replicator'): for n in xrange(1, 5): - ps.append(Popen(['/usr/bin/swift-%s' % job, + ps.append(Popen(['swift-%s' % job, '/etc/swift/%s-server/%d.conf' % (job.split('-')[0], n), 'once'])) @@ -78,7 +78,7 @@ def get_to_final_state(): ps = [] for job in ('container-updater', 'object-updater'): for n in xrange(1, 5): - ps.append(Popen(['/usr/bin/swift-%s' % job, + ps.append(Popen(['swift-%s' % job, '/etc/swift/%s-server/%d.conf' % (job.split('-')[0], n), 'once'])) @@ -88,7 +88,7 @@ def get_to_final_state(): for job in ('account-replicator', 'container-replicator', 'object-replicator'): for n in xrange(1, 5): - ps.append(Popen(['/usr/bin/swift-%s' % job, + ps.append(Popen(['swift-%s' % job, '/etc/swift/%s-server/%d.conf' % (job.split('-')[0], n), 'once'])) diff --git a/test/probe/test_account_failures.py b/test/probe/test_account_failures.py index 2e84cc0640..97397084e0 100755 --- a/test/probe/test_account_failures.py +++ b/test/probe/test_account_failures.py @@ -110,7 +110,7 @@ class TestAccountFailures(unittest.TestCase): ps = [] for n in xrange(1, 5): - ps.append(Popen(['/usr/bin/swift-container-updater', + ps.append(Popen(['swift-container-updater', '/etc/swift/container-server/%d.conf' % n, 'once'])) for p in ps: @@ -130,7 +130,7 @@ class TestAccountFailures(unittest.TestCase): self.assert_(found2) self.pids[self.port2server[anodes[0]['port']]] = \ - Popen(['/usr/bin/swift-account-server', + Popen(['swift-account-server', '/etc/swift/account-server/%d.conf' % ((anodes[0]['port'] - 6002) / 10)]).pid sleep(2) diff --git a/test/probe/test_container_failures.py b/test/probe/test_container_failures.py index cc042cb1c1..932f821c1c 100755 --- a/test/probe/test_container_failures.py +++ b/test/probe/test_container_failures.py @@ -59,7 +59,7 @@ class TestContainerFailures(unittest.TestCase): client.get_container(self.url, self.token, container)]) self.pids[self.port2server[cnodes[0]['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnodes[0]['port'] - 6001) / 10)]).pid sleep(2) @@ -135,7 +135,7 @@ class TestContainerFailures(unittest.TestCase): client.get_container(self.url, self.token, container)]) self.pids[self.port2server[cnodes[1]['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnodes[1]['port'] - 6001) / 10)]).pid sleep(2) @@ -210,7 +210,7 @@ class TestContainerFailures(unittest.TestCase): for x in xrange(2): self.pids[self.port2server[cnodes[x]['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnodes[x]['port'] - 6001) / 10)]).pid sleep(2) @@ -288,7 +288,7 @@ class TestContainerFailures(unittest.TestCase): for x in (1, 2): self.pids[self.port2server[cnodes[x]['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnodes[x]['port'] - 6001) / 10)]).pid sleep(2) diff --git a/test/probe/test_object_async_update.py b/test/probe/test_object_async_update.py index 841a7e6e7d..4b4c3a49b7 100755 --- a/test/probe/test_object_async_update.py +++ b/test/probe/test_object_async_update.py @@ -47,7 +47,7 @@ class TestObjectAsyncUpdate(unittest.TestCase): obj = 'object-%s' % uuid4() client.put_object(self.url, self.token, container, obj, '') self.pids[self.port2server[cnode['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnode['port'] - 6001) / 10)]).pid sleep(2) @@ -55,7 +55,7 @@ class TestObjectAsyncUpdate(unittest.TestCase): self.account, container)) ps = [] for n in xrange(1, 5): - ps.append(Popen(['/usr/bin/swift-object-updater', + ps.append(Popen(['swift-object-updater', '/etc/swift/object-server/%d.conf' % n, 'once'])) for p in ps: p.wait() diff --git a/test/probe/test_object_handoff.py b/test/probe/test_object_handoff.py index 885a6fb198..6afec71450 100755 --- a/test/probe/test_object_handoff.py +++ b/test/probe/test_object_handoff.py @@ -61,7 +61,7 @@ class TestObjectHandoff(unittest.TestCase): 'returned: %s' % repr(odata)) for node in onodes[1:]: self.pids[self.port2server[node['port']]] = Popen([ - '/usr/bin/swift-object-server', + 'swift-object-server', '/etc/swift/object-server/%d.conf' % ((node['port'] - 6000) / 10)]).pid sleep(2) @@ -86,7 +86,7 @@ class TestObjectHandoff(unittest.TestCase): 'Container server %s:%s did not know about object' % (cnode['ip'], cnode['port'])) self.pids[self.port2server[onode['port']]] = Popen([ - '/usr/bin/swift-object-server', + 'swift-object-server', '/etc/swift/object-server/%d.conf' % ((onode['port'] - 6000) / 10)]).pid sleep(2) @@ -101,12 +101,12 @@ class TestObjectHandoff(unittest.TestCase): # Run the extra server last so it'll remove it's extra partition ps = [] for n in onodes: - ps.append(Popen(['/usr/bin/swift-object-replicator', + ps.append(Popen(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((n['port'] - 6000) / 10), 'once'])) for p in ps: p.wait() - call(['/usr/bin/swift-object-replicator', + call(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((another_onode['port'] - 6000) / 10), 'once']) odata = direct_client.direct_get_object(onode, opart, self.account, @@ -139,7 +139,7 @@ class TestObjectHandoff(unittest.TestCase): raise Exception('Handoff server claimed it had the object when ' 'it should not have it') self.pids[self.port2server[onode['port']]] = Popen([ - '/usr/bin/swift-object-server', + 'swift-object-server', '/etc/swift/object-server/%d.conf' % ((onode['port'] - 6000) / 10)]).pid sleep(2) @@ -151,12 +151,12 @@ class TestObjectHandoff(unittest.TestCase): # Run the extra server last so it'll remove it's extra partition ps = [] for n in onodes: - ps.append(Popen(['/usr/bin/swift-object-replicator', + ps.append(Popen(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((n['port'] - 6000) / 10), 'once'])) for p in ps: p.wait() - call(['/usr/bin/swift-object-replicator', + call(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((another_onode['port'] - 6000) / 10), 'once']) ometadata = direct_client.direct_get_object(onode, opart, self.account, @@ -187,7 +187,7 @@ class TestObjectHandoff(unittest.TestCase): 'Container server %s:%s still knew about object' % (cnode['ip'], cnode['port'])) self.pids[self.port2server[onode['port']]] = Popen([ - '/usr/bin/swift-object-server', + 'swift-object-server', '/etc/swift/object-server/%d.conf' % ((onode['port'] - 6000) / 10)]).pid sleep(2) @@ -196,12 +196,12 @@ class TestObjectHandoff(unittest.TestCase): # Run the extra server last so it'll remove it's extra partition ps = [] for n in onodes: - ps.append(Popen(['/usr/bin/swift-object-replicator', + ps.append(Popen(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((n['port'] - 6000) / 10), 'once'])) for p in ps: p.wait() - call(['/usr/bin/swift-object-replicator', + call(['swift-object-replicator', '/etc/swift/object-server/%d.conf' % ((another_onode['port'] - 6000) / 10), 'once']) exc = False diff --git a/test/probe/test_running_with_each_type_down.py b/test/probe/test_running_with_each_type_down.py index a5682c7e3f..fada1b18ac 100755 --- a/test/probe/test_running_with_each_type_down.py +++ b/test/probe/test_running_with_each_type_down.py @@ -72,15 +72,15 @@ class TestRunningWithEachTypeDown(unittest.TestCase): self.assert_(found1) self.pids[self.port2server[anodes[0]['port']]] = \ - Popen(['/usr/bin/swift-account-server', + Popen(['swift-account-server', '/etc/swift/account-server/%d.conf' % ((anodes[0]['port'] - 6002) / 10)]).pid self.pids[self.port2server[cnodes[0]['port']]] = \ - Popen(['/usr/bin/swift-container-server', + Popen(['swift-container-server', '/etc/swift/container-server/%d.conf' % ((cnodes[0]['port'] - 6001) / 10)]).pid self.pids[self.port2server[onodes[0]['port']]] = \ - Popen(['/usr/bin/swift-object-server', + Popen(['swift-object-server', '/etc/swift/object-server/%d.conf' % ((onodes[0]['port'] - 6000) / 10)]).pid sleep(2) From 5e8bc7d8ca9448807e7b8ba221aee45c61878510 Mon Sep 17 00:00:00 2001 From: Chuck Thier Date: Mon, 19 Jul 2010 01:21:43 -0500 Subject: [PATCH 2/2] Updated setup.py so that the test directory would be correctly ignored when installing --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1fa1a75538..677c095b81 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup( license='Apache License (2.0)', author='OpenStack, LLC.', url='https://launchpad.net/swift', - packages=find_packages(exclude=['tests','bin']), + packages=find_packages(exclude=['test','bin']), test_suite = 'nose.collector', classifiers=[ 'Development Status :: 4 - Beta',