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
69caa85b
Commit
69caa85b
authored
Mar 16, 2022
by
Michael Howitz
Committed by
GitHub
Mar 16, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into python38-and-39
parents
0a46d168
149af836
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
1 deletion
+43
-1
CHANGES.rst
CHANGES.rst
+3
-0
src/ZEO/asyncio/base.py
src/ZEO/asyncio/base.py
+3
-0
src/ZEO/asyncio/tests.py
src/ZEO/asyncio/tests.py
+28
-0
src/ZEO/tests/drop_cache_rather_than_verify.txt
src/ZEO/tests/drop_cache_rather_than_verify.txt
+9
-1
No files found.
CHANGES.rst
View file @
69caa85b
...
@@ -9,6 +9,9 @@ Changelog
...
@@ -9,6 +9,9 @@ Changelog
- Add more accurate error handling for ``asyncio.CancelledError``.
- Add more accurate error handling for ``asyncio.CancelledError``.
See `issue 165 <https://github.com/zopefoundation/ZEO/issues/165>`_.
See `issue 165 <https://github.com/zopefoundation/ZEO/issues/165>`_.
- Fix bug related to blobs stored by ``ZEO``
`#150 <https://github.com/zopefoundation/ZEO/issues/150>`_.
5.2.3 (2021-08-09)
5.2.3 (2021-08-09)
------------------
------------------
...
...
src/ZEO/asyncio/base.py
View file @
69caa85b
...
@@ -77,6 +77,9 @@ class Protocol(asyncio.Protocol):
...
@@ -77,6 +77,9 @@ class Protocol(asyncio.Protocol):
# will be used with blobs, in which case, the individual
# will be used with blobs, in which case, the individual
# messages will be big to begin with.
# messages will be big to begin with.
data
=
iter
(
data
)
data
=
iter
(
data
)
if
paused
:
append
(
data
)
return
for
message
in
data
:
for
message
in
data
:
writelines
((
pack
(
">I"
,
len
(
message
)),
message
))
writelines
((
pack
(
">I"
,
len
(
message
)),
message
))
if
paused
:
if
paused
:
...
...
src/ZEO/asyncio/tests.py
View file @
69caa85b
...
@@ -2,8 +2,12 @@ from .._compat import PY3
...
@@ -2,8 +2,12 @@ from .._compat import PY3
if
PY3
:
if
PY3
:
import
asyncio
import
asyncio
def
to_byte
(
i
):
return
bytes
([
i
])
else
:
else
:
import
trollius
as
asyncio
import
trollius
as
asyncio
def
to_byte
(
b
):
return
b
from
zope.testing
import
setupstack
from
zope.testing
import
setupstack
from
concurrent.futures
import
Future
from
concurrent.futures
import
Future
...
@@ -18,6 +22,7 @@ import unittest
...
@@ -18,6 +22,7 @@ import unittest
from
..Exceptions
import
ClientDisconnected
,
ProtocolError
from
..Exceptions
import
ClientDisconnected
,
ProtocolError
from
.base
import
Protocol
from
.testing
import
Loop
from
.testing
import
Loop
from
.client
import
ClientRunner
,
Fallback
from
.client
import
ClientRunner
,
Fallback
from
.server
import
new_connection
,
best_protocol_version
from
.server
import
new_connection
,
best_protocol_version
...
@@ -869,10 +874,33 @@ class Logging(object):
...
@@ -869,10 +874,33 @@ class Logging(object):
logging
.
getLogger
().
setLevel
(
logging
.
NOTSET
)
logging
.
getLogger
().
setLevel
(
logging
.
NOTSET
)
class
ProtocolTests
(
setupstack
.
TestCase
):
def
setUp
(
self
):
self
.
loop
=
loop
=
Loop
()
loop
.
create_connection
(
lambda
:
Protocol
(
loop
,
None
),
sock
=
True
)
def
test_writeit
(
self
):
"""test https://github.com/zopefoundation/ZEO/issues/150."""
loop
=
self
.
loop
protocol
,
transport
=
loop
.
protocol
,
loop
.
transport
transport
.
capacity
=
1
# single message
def
it
(
tag
):
yield
tag
yield
tag
protocol
.
_writeit
(
it
(
b"0"
))
protocol
.
_writeit
(
it
(
b"1"
))
for
b
in
b"0011"
:
l
,
t
=
transport
.
pop
(
2
)
self
.
assertEqual
(
l
,
b"
\
x00
\
x00
\
x00
\
x01
"
)
self
.
assertEqual
(
t
,
to_byte
(
b
))
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
ClientTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
ClientTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
ServerTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
ServerTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
MsgpackClientTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
MsgpackClientTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
MsgpackServerTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
MsgpackServerTests
))
suite
.
addTest
(
unittest
.
makeSuite
(
ProtocolTests
))
return
suite
return
suite
src/ZEO/tests/drop_cache_rather_than_verify.txt
View file @
69caa85b
...
@@ -75,6 +75,10 @@ Now, we'll restart the server on the original address:
...
@@ -75,6 +75,10 @@ Now, we'll restart the server on the original address:
>>> wait_connected(db.storage)
>>> wait_connected(db.storage)
##### debugging only ########
>>> print(db.storage._server.client.verify_result)
cache too old, clearing
Now, let's verify our assertions above:
Now, let's verify our assertions above:
- Publishes a stale-cache event.
- Publishes a stale-cache event.
...
@@ -141,7 +145,11 @@ another client:
...
@@ -141,7 +145,11 @@ another client:
(When a database is created, it checks to make sure the root object is
(When a database is created, it checks to make sure the root object is
in the database, which is why we get 1, rather than 0 objects in the cache.)
in the database, which is why we get 1, rather than 0 objects in the cache.)
- Publishes a stake-cache event.
##### debugging only ########
>>> print(db.storage._server.client.verify_result)
cache too old, clearing
- Publishes a stale-cache event.
>>> for e in events:
>>> for e in events:
... print(e)
... print(e)
...
...
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