[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/tests/zeo-fan-out.test Take advantage of new helper functions.
Jim Fulton
jim at zope.com
Sun Nov 16 12:11:47 EST 2008
Log message for revision 93015:
Take advantage of new helper functions.
Changed:
U ZODB/trunk/src/ZEO/tests/zeo-fan-out.test
-=-
Modified: ZODB/trunk/src/ZEO/tests/zeo-fan-out.test
===================================================================
--- ZODB/trunk/src/ZEO/tests/zeo-fan-out.test 2008-11-16 17:11:45 UTC (rev 93014)
+++ ZODB/trunk/src/ZEO/tests/zeo-fan-out.test 2008-11-16 17:11:47 UTC (rev 93015)
@@ -9,41 +9,26 @@
We'll start the first server:
- >>> import ZEO.tests.forker, ZEO.tests.testZEO
- >>> port0 = ZEO.tests.testZEO.get_port()
- >>> zconf0 = ZEO.tests.forker.ZEOConfig(('', port0))
- >>> zport0, adminaddr0, pid0, path0 = ZEO.tests.forker.start_zeo_server(
- ... '<filestorage 1>\n path fs\n</filestorage>\n', zconf0,
- ... port0, keep=1)
+ >>> (_, port0), adminaddr0 = start_server(
+ ... '<filestorage>\npath fs\n</filestorage>', keep=1)
-
Then we'll start 2 others that use this one:
- >>> port1 = ZEO.tests.testZEO.get_port()
- >>> zconf1 = ZEO.tests.forker.ZEOConfig(('', port1))
- >>> zport1, adminaddr1, pid1, path1 = ZEO.tests.forker.start_zeo_server(
- ... '<zeoclient 1>\n server %s\n</zeoclient>\n' % port0,
- ... zconf1, port1)
+ >>> addr1, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
+ >>> addr2, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
- >>> port2 = ZEO.tests.testZEO.get_port()
- >>> zconf2 = ZEO.tests.forker.ZEOConfig(('', port2))
- >>> zport2, adminaddr2, pid2, path2 = ZEO.tests.forker.start_zeo_server(
- ... '<zeoclient 1>\n server %s\n</zeoclient>\n' % port0,
- ... zconf2, port2)
-
-
Now, let's create some client storages that connect to these:
>>> import ZEO, transaction
- >>> db1 = ZEO.DB(('localhost', port1), '1')
+ >>> db1 = ZEO.DB(addr1)
>>> tm1 = transaction.TransactionManager()
>>> c1 = db1.open(transaction_manager=tm1)
>>> r1 = c1.root()
>>> r1
{}
- >>> db2 = ZEO.DB(('localhost', port2), '1')
+ >>> db2 = ZEO.DB(addr2)
>>> tm2 = transaction.TransactionManager()
>>> c2 = db2.open(transaction_manager=tm2)
>>> r2 = c2.root()
@@ -99,9 +84,9 @@
If we shutdown and restart the source server, the variables will be
invalidated:
- >>> ZEO.tests.forker.shutdown_zeo_server(adminaddr0)
- >>> zport0, adminaddr0, pid0, path0 = ZEO.tests.forker.start_zeo_server(
- ... '<filestorage 1>\n path fs\n</filestorage>\n', zconf0, port0)
+ >>> stop_server(adminaddr0)
+ >>> _ = start_server('<filestorage 1>\npath fs\n</filestorage>\n',
+ ... port=port0)
>>> for i in range(1000):
... c1.sync()
@@ -126,6 +111,3 @@
>>> db1.close()
>>> db2.close()
- >>> ZEO.tests.forker.shutdown_zeo_server(adminaddr2)
- >>> ZEO.tests.forker.shutdown_zeo_server(adminaddr1)
- >>> ZEO.tests.forker.shutdown_zeo_server(adminaddr0)
More information about the Zodb-checkins
mailing list