Skip to content

Commit

Permalink
Updated for new underware and new higher minimum protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed May 27, 2016
1 parent eda1bb0 commit 8e1d0ce
Showing 1 changed file with 9 additions and 30 deletions.
39 changes: 9 additions & 30 deletions src/ZEO/tests/protocols.test
Expand Up @@ -17,15 +17,15 @@ Let's start a Z308 server
... '''

>>> addr, admin = start_server(
... storage_conf, dict(invalidation_queue_size=5), protocol=b'Z308')
... storage_conf, dict(invalidation_queue_size=5), protocol=b'Z309')

A current client should be able to connect to a old server:

>>> import ZEO, ZODB.blob, transaction
>>> db = ZEO.DB(addr, client='client', blob_dir='blobs')
>>> wait_connected(db.storage)
>>> db.storage._connection.peer_protocol_version
b'Z308'
>>> db.storage.protocol_version
b'Z309'

>>> conn = db.open()
>>> conn.root().x = 0
Expand Down Expand Up @@ -85,13 +85,6 @@ A current client should be able to connect to a old server:
... f.read()
b'blob data 2'

Note that when taking to a 3.8 server, iteration won't work:

>>> db.storage.iterator()
Traceback (most recent call last):
...
NotImplementedError

>>> db2.close()
>>> db.close()
>>> stop_server(admin)
Expand All @@ -107,13 +100,13 @@ And the other way around:

Note that we'll have to pull some hijinks:

>>> import ZEO.zrpc.connection
>>> old_current_protocol = ZEO.zrpc.connection.Connection.current_protocol
>>> ZEO.zrpc.connection.Connection.current_protocol = b'Z308'
>>> import ZEO.asyncio.client
>>> old_protocols = ZEO.asyncio.client.Protocol.protocols
>>> ZEO.asyncio.client.Protocol.protocols = [b'Z309']

>>> db = ZEO.DB(addr, client='client', blob_dir='blobs')
>>> db.storage._connection.peer_protocol_version
b'Z308'
>>> db.storage.protocol_version
b'Z309'
>>> wait_connected(db.storage)
>>> conn = db.open()
>>> conn.root().x = 0
Expand Down Expand Up @@ -174,23 +167,9 @@ Note that we'll have to pull some hijinks:
... f.read()
b'blob data 2'

Make some old protocol calls:

>>> db.storage._server.rpc.call('getSerial', conn.root()._p_oid
... ) == conn.root()._p_serial
True

>>> p, s, v, x, y = db.storage._server.rpc.call('zeoLoad',
... conn.root()._p_oid)
>>> (v, x, y) == ('', None, None)
True
>>> db.storage.load(conn.root()._p_oid) == (p, s)
True


>>> db2.close()
>>> db.close()

Undo the hijinks:

>>> ZEO.zrpc.connection.Connection.current_protocol = old_current_protocol
>>> ZEO.asyncio.client.Protocol.protocols = old_protocols

0 comments on commit 8e1d0ce

Please sign in to comment.