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. ...@@ -9,41 +9,26 @@ ZEO servers for us and another one that picks ports.
We'll start the first server: We'll start the first server:
>>> import ZEO.tests.forker, ZEO.tests.testZEO >>> (_, port0), adminaddr0 = start_server(
>>> port0 = ZEO.tests.testZEO.get_port() ... '<filestorage>\npath fs\n</filestorage>', keep=1)
>>> 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)
Then we'll start 2 others that use this one: Then we'll start 2 others that use this one:
>>> port1 = ZEO.tests.testZEO.get_port() >>> addr1, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
>>> zconf1 = ZEO.tests.forker.ZEOConfig(('', port1)) >>> addr2, _ = start_server('<zeoclient>\nserver %s\n</zeoclient>' % port0)
>>> 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)
Now, let's create some client storages that connect to these: Now, let's create some client storages that connect to these:
>>> import ZEO, transaction >>> import ZEO, transaction
>>> db1 = ZEO.DB(('localhost', port1), '1') >>> db1 = ZEO.DB(addr1)
>>> tm1 = transaction.TransactionManager() >>> tm1 = transaction.TransactionManager()
>>> c1 = db1.open(transaction_manager=tm1) >>> c1 = db1.open(transaction_manager=tm1)
>>> r1 = c1.root() >>> r1 = c1.root()
>>> r1 >>> r1
{} {}
>>> db2 = ZEO.DB(('localhost', port2), '1') >>> db2 = ZEO.DB(addr2)
>>> tm2 = transaction.TransactionManager() >>> tm2 = transaction.TransactionManager()
>>> c2 = db2.open(transaction_manager=tm2) >>> c2 = db2.open(transaction_manager=tm2)
>>> r2 = c2.root() >>> r2 = c2.root()
...@@ -99,9 +84,9 @@ Now, let's see if we can break it. :) ...@@ -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 If we shutdown and restart the source server, the variables will be
invalidated: invalidated:
>>> ZEO.tests.forker.shutdown_zeo_server(adminaddr0) >>> stop_server(adminaddr0)
>>> zport0, adminaddr0, pid0, path0 = ZEO.tests.forker.start_zeo_server( >>> _ = start_server('<filestorage 1>\npath fs\n</filestorage>\n',
... '<filestorage 1>\n path fs\n</filestorage>\n', zconf0, port0) ... port=port0)
>>> for i in range(1000): >>> for i in range(1000):
... c1.sync() ... c1.sync()
...@@ -126,6 +111,3 @@ Cleanup: ...@@ -126,6 +111,3 @@ Cleanup:
>>> db1.close() >>> db1.close()
>>> db2.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