Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
04e491e9
Commit
04e491e9
authored
Jun 28, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made new_addr.test more robust
parent
f15668b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
src/ZEO/tests/new_addr.test
src/ZEO/tests/new_addr.test
+10
-17
No files found.
src/ZEO/tests/new_addr.test
View file @
04e491e9
...
...
@@ -2,12 +2,10 @@ You can change the address(es) of a client storaage.
We
'll start by setting up a server and connecting to it:
>>> import ZEO, ZEO.StorageServer, ZODB.FileStorage, transaction
>>> server = ZEO.StorageServer.StorageServer(
... ('
127.0
.
0.1
', 0), {'
1
': ZODB.FileStorage.FileStorage('
t
.
fs
')})
>>> server.start_thread()
>>> import ZEO, transaction
>>> conn = ZEO.connection(server.addr, max_disconnect_poll=0.1)
>>> addr, stop = ZEO.server(path='
test
.
fs
')
>>> conn = ZEO.connection(addr)
>>> client = conn.db().storage
>>> client.is_connected()
True
...
...
@@ -18,30 +16,25 @@ We'll start by setting up a server and connecting to it:
Now we'
ll
close
the
server
:
>>>
s
erver
.
close
()
>>>
s
top
()
And
wait
for
the
connectin
to
notice
it
's disconnected:
>>> wait_until(lambda : not client.is_connected())
Now, we'
ll
restart
the
server
and
update
the
connection
:
>>>
server
=
ZEO
.
StorageServer
.
StorageServer
(
...
(
'127.0.0.1'
,
0
),
{
'1'
:
ZODB
.
FileStorage
.
FileStorage
(
't.fs'
)})
>>>
server
.
start_thread
()
>>>
client
.
new_addr
(
server
.
addr
)
Now, we'
ll
restart
the
server
:
>>>
addr
,
stop
=
ZEO
.
server
(
path
=
'test.fs'
)
Update
with
another
client
:
>>>
conn2
=
ZEO
.
connection
(
server
.
addr
)
>>>
conn2
=
ZEO
.
connection
(
addr
)
>>>
conn2
.
root
.
x
+=
1
>>>
transaction
.
commit
()
W
ait
for
connect
:
Update
the
connection
and
w
ait
for
connect
:
>>>
client
.
new_addr
(
addr
)
>>>
wait_until
(
lambda
:
client
.
is_connected
())
>>>
_
=
transaction
.
begin
()
>>>
conn
.
root
()
...
...
@@ -51,4 +44,4 @@ Wait for connect:
>>>
conn
.
close
()
>>>
conn2
.
close
()
>>>
s
erver
.
close
()
>>>
s
top
()
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