Merge "Ensure that files are always closed in the tests."

This commit is contained in:
Jenkins 2013-07-19 03:30:16 +00:00 committed by Gerrit Code Review
commit 39b48e1e9f

View File

@ -113,24 +113,27 @@ def setup():
obj2lis = listen(('localhost', 0)) obj2lis = listen(('localhost', 0))
_test_sockets = \ _test_sockets = \
(prolis, acc1lis, acc2lis, con1lis, con2lis, obj1lis, obj2lis) (prolis, acc1lis, acc2lis, con1lis, con2lis, obj1lis, obj2lis)
pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]], with GzipFile(os.path.join(_testdir, 'account.ring.gz'), 'wb') as f:
[{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1', pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
'port': acc1lis.getsockname()[1]}, [{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1',
{'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1', 'port': acc1lis.getsockname()[1]},
'port': acc2lis.getsockname()[1]}], 30), {'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1',
GzipFile(os.path.join(_testdir, 'account.ring.gz'), 'wb')) 'port': acc2lis.getsockname()[1]}], 30),
pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]], f)
[{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1', with GzipFile(os.path.join(_testdir, 'container.ring.gz'), 'wb') as f:
'port': con1lis.getsockname()[1]}, pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
{'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1', [{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1',
'port': con2lis.getsockname()[1]}], 30), 'port': con1lis.getsockname()[1]},
GzipFile(os.path.join(_testdir, 'container.ring.gz'), 'wb')) {'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1',
pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]], 'port': con2lis.getsockname()[1]}], 30),
[{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1', f)
'port': obj1lis.getsockname()[1]}, with GzipFile(os.path.join(_testdir, 'object.ring.gz'), 'wb') as f:
{'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1', pickle.dump(ring.RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
'port': obj2lis.getsockname()[1]}], 30), [{'id': 0, 'zone': 0, 'device': 'sda1', 'ip': '127.0.0.1',
GzipFile(os.path.join(_testdir, 'object.ring.gz'), 'wb')) 'port': obj1lis.getsockname()[1]},
{'id': 1, 'zone': 1, 'device': 'sdb1', 'ip': '127.0.0.1',
'port': obj2lis.getsockname()[1]}], 30),
f)
prosrv = proxy_server.Application(conf, FakeMemcacheReturnsNone()) prosrv = proxy_server.Application(conf, FakeMemcacheReturnsNone())
acc1srv = account_server.AccountController(conf) acc1srv = account_server.AccountController(conf)
acc2srv = account_server.AccountController(conf) acc2srv = account_server.AccountController(conf)