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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
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
Show 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.
...
@@ -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:
We
'll start by setting up a server and connecting to it:
>>> import ZEO, ZEO.StorageServer, ZODB.FileStorage, transaction
>>> import ZEO, transaction
>>> server = ZEO.StorageServer.StorageServer(
... ('
127.0
.
0.1
', 0), {'
1
': ZODB.FileStorage.FileStorage('
t
.
fs
')})
>>> server.start_thread()
>>> 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 = conn.db().storage
>>> client.is_connected()
>>> client.is_connected()
True
True
...
@@ -18,30 +16,25 @@ We'll start by setting up a server and connecting to it:
...
@@ -18,30 +16,25 @@ We'll start by setting up a server and connecting to it:
Now we'
ll
close
the
server
:
Now we'
ll
close
the
server
:
>>>
s
erver
.
close
()
>>>
s
top
()
And
wait
for
the
connectin
to
notice
it
's disconnected:
And
wait
for
the
connectin
to
notice
it
's disconnected:
>>> wait_until(lambda : not client.is_connected())
>>> wait_until(lambda : not client.is_connected())
Now, we'
ll
restart
the
server
and
update
the
connection
:
Now, we'
ll
restart
the
server
:
>>>
server
=
ZEO
.
StorageServer
.
StorageServer
(
...
(
'127.0.0.1'
,
0
),
{
'1'
:
ZODB
.
FileStorage
.
FileStorage
(
't.fs'
)})
>>>
server
.
start_thread
()
>>>
client
.
new_addr
(
server
.
addr
)
>>>
addr
,
stop
=
ZEO
.
server
(
path
=
'test.fs'
)
Update
with
another
client
:
Update
with
another
client
:
>>>
conn2
=
ZEO
.
connection
(
server
.
addr
)
>>>
conn2
=
ZEO
.
connection
(
addr
)
>>>
conn2
.
root
.
x
+=
1
>>>
conn2
.
root
.
x
+=
1
>>>
transaction
.
commit
()
>>>
transaction
.
commit
()
W
ait
for
connect
:
Update
the
connection
and
w
ait
for
connect
:
>>>
client
.
new_addr
(
addr
)
>>>
wait_until
(
lambda
:
client
.
is_connected
())
>>>
wait_until
(
lambda
:
client
.
is_connected
())
>>>
_
=
transaction
.
begin
()
>>>
_
=
transaction
.
begin
()
>>>
conn
.
root
()
>>>
conn
.
root
()
...
@@ -51,4 +44,4 @@ Wait for connect:
...
@@ -51,4 +44,4 @@ Wait for connect:
>>>
conn
.
close
()
>>>
conn
.
close
()
>>>
conn2
.
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