Commit a916f878 authored by Jim Fulton's avatar Jim Fulton

Take advantage of new helper functions.

parent a6087fbb
......@@ -9,41 +9,26 @@ ZEO servers for us and another one that picks ports.
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)
>>> 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)
>>> addr1, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
>>> addr2, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
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 @@ Now, let's see if we can break it. :)
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 @@ Cleanup:
>>> 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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment