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
c4297758
Commit
c4297758
authored
Jun 28, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made dynamic_server_ports.test more robust
parent
0e06dc44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
33 deletions
+12
-33
src/ZEO/tests/dynamic_server_ports.test
src/ZEO/tests/dynamic_server_ports.test
+12
-33
No files found.
src/ZEO/tests/dynamic_server_ports.test
View file @
c4297758
...
@@ -14,67 +14,46 @@ ZODB.notify.
...
@@ -14,67 +14,46 @@ ZODB.notify.
Now
,
let
's start a server and verify that we get a serving event:
Now
,
let
's start a server and verify that we get a serving event:
>>> import ZEO.StorageServer, ZODB.MappingStorage
>>> import ZEO
>>> server = ZEO.StorageServer.StorageServer(
>>> addr, stop = ZEO.server()
... ('
127.0
.
0.1
', 0), {'
1
': ZODB.MappingStorage.MappingStorage()})
>>> isinstance(last_event, ZEO.StorageServer.Serving)
>>> isinstance(last_event, ZEO.StorageServer.Serving)
True
True
>>> last_event.server is server
True
>>> last_event.address[0], last_event.address[1] > 0
('
127.0
.
0.1
', True)
If the host part pf the address passed to the constructor is not an
>>> last_event.address == addr
empty string. then the server addr attribute is the same as the
address attribute of the event:
>>> server.addr == last_event.address
True
True
Let'
s
run
the
server
in
a
thread
,
to
make
sure
we
can
connect
.
>>> server = last_event.server
>>> server.addr == addr
True
>>>
server
.
start_thread
()
Let'
s
make
sure
we
can
connect
.
>>>
client
=
ZEO
.
client
(
last_event
.
address
)
>>>
client
=
ZEO
.
client
(
last_event
.
address
)
.
close
()
>>>
client
.
is_connected
()
True
If
we
close
the
server
,
we
'll get a closed event:
If
we
close
the
server
,
we
'll get a closed event:
>>> s
erver.close
()
>>> s
top
()
>>> isinstance(last_event, ZEO.StorageServer.Closed)
>>> isinstance(last_event, ZEO.StorageServer.Closed)
True
True
>>> last_event.server is server
>>> last_event.server is server
True
True
>>> wait_until(lambda : not client.is_connected(test=True))
>>> client.close()
If we pass an empty string as the host part of the server address, we
If we pass an empty string as the host part of the server address, we
can'
t
really
assign
a
single
address
,
so
the
server
addr
attribute
is
can'
t
really
assign
a
single
address
,
so
the
server
addr
attribute
is
left
alone
:
left
alone
:
>>>
server
=
ZEO
.
StorageServer
.
StorageServer
(
>>>
addr
,
stop
=
ZEO
.
server
(
port
=
(
''
,
0
))
...
(
''
,
0
),
{
'1'
:
ZODB
.
MappingStorage
.
MappingStorage
()})
>>>
isinstance
(
last_event
,
ZEO
.
StorageServer
.
Serving
)
>>>
isinstance
(
last_event
,
ZEO
.
StorageServer
.
Serving
)
True
True
>>>
last_event
.
server
is
server
True
>>>
last_event
.
address
[
1
]
>
0
>>>
last_event
.
address
[
1
]
>
0
True
True
If
the
host
part
pf
the
address
passed
to
the
constructor
is
not
an
>>>
last_event
.
server
.
addr
empty
string
.
then
the
server
addr
attribute
is
the
same
as
the
address
attribute
of
the
event
:
>>>
server
.
addr
(
''
,
0
)
(
''
,
0
)
>>>
s
erver
.
close
()
>>>
s
top
()
The
runzeo
module
provides
some
process
support
,
including
getting
the
The
runzeo
module
provides
some
process
support
,
including
getting
the
server
configuration
via
a
ZConfig
configuration
file
.
To
spell
a
server
configuration
via
a
ZConfig
configuration
file
.
To
spell
a
...
...
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