Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
a916f878
Commit
a916f878
authored
Nov 16, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take advantage of new helper functions.
parent
a6087fbb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
27 deletions
+9
-27
src/ZEO/tests/zeo-fan-out.test
src/ZEO/tests/zeo-fan-out.test
+9
-27
No files found.
src/ZEO/tests/zeo-fan-out.test
View file @
a916f878
...
...
@@ -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)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment