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
be4a057c
Commit
be4a057c
authored
Oct 01, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add two tests of bad messages sent over the connection.
parent
86ee748a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
src/ZEO/tests/ConnectionTests.py
src/ZEO/tests/ConnectionTests.py
+37
-0
No files found.
src/ZEO/tests/ConnectionTests.py
View file @
be4a057c
...
...
@@ -25,6 +25,7 @@ import zLOG
import
ZEO.ClientStorage
from
ZEO.Exceptions
import
Disconnected
from
ZEO.zrpc.marshal
import
Marshaller
from
ZODB.Transaction
import
get_transaction
from
ZODB.POSException
import
ReadOnlyError
...
...
@@ -452,3 +453,39 @@ class ConnectionTests(StorageTestBase.StorageTestBase):
# inherit from POSException.
zLOG
.
LOG
(
"checkReconnection"
,
zLOG
.
INFO
,
"finished"
)
def
checkBadMessage1
(
self
):
# not even close to a real message
self
.
_bad_message
(
"salty"
)
def
checkBadMessage2
(
self
):
# just like a real message, but with an unpicklable argument
global
Hack
class
Hack
:
pass
msg
=
Marshaller
().
encode
(
1
,
0
,
"foo"
,
(
Hack
(),))
self
.
_bad_message
(
msg
)
del
Hack
def
_bad_message
(
self
,
msg
):
# Establish a connection, then send the server an ill-formatted
# request. Verify that the connection is closed and that it is
# possible to establish a new connection.
self
.
_storage
=
self
.
openClientStorage
()
self
.
_dostore
()
# break into the internals to send a bogus message
zrpc_conn
=
self
.
_storage
.
_server
.
rpc
zrpc_conn
.
message_output
(
msg
)
try
:
self
.
_dostore
()
except
Disconnected
:
pass
else
:
self
.
fail
(
"Server did not disconnect after bogus message"
)
self
.
_storage
=
self
.
openClientStorage
()
self
.
_dostore
()
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