Commit f4725366 authored by Julien Muchembled's avatar Julien Muchembled

qa: add testProtocolVersionMismatch

parent 43029be2
...@@ -63,7 +63,7 @@ Which has in turn other consequences: ...@@ -63,7 +63,7 @@ Which has in turn other consequences:
received yet a notification from the master). received yet a notification from the master).
- Writes must be accepted blindly (i.e. without taking a write-lock) when a - Writes must be accepted blindly (i.e. without taking a write-lock) when a
storage node lacks the data to check for conflicts. This is possible because storage node lacks the data to check for conflicts. This is possible because
1 up-to-date cell (for each partition) is enough to do these checks. 1 readable cell (for each partition) is enough to do these checks.
- Because the client can not reliably know if a storage node is expected to - Because the client can not reliably know if a storage node is expected to
receive a transaction in full, all writes must succeed. receive a transaction in full, all writes must succeed.
- Even if the replication is finished, we have to wait that we don't have any - Even if the replication is finished, we have to wait that we don't have any
......
...@@ -29,7 +29,7 @@ from ZODB import DB, POSException ...@@ -29,7 +29,7 @@ from ZODB import DB, POSException
from ZODB.DB import TransactionalUndo from ZODB.DB import TransactionalUndo
from neo.storage.transactions import TransactionManager, ConflictError from neo.storage.transactions import TransactionManager, ConflictError
from neo.lib.connection import ConnectionClosed, \ from neo.lib.connection import ConnectionClosed, \
ServerConnection, MTClientConnection ClientConnection, ServerConnection, MTClientConnection
from neo.lib.exception import StoppedOperation from neo.lib.exception import StoppedOperation
from neo.lib.handler import DelayEvent, EventHandler from neo.lib.handler import DelayEvent, EventHandler
from neo.lib import logging from neo.lib import logging
...@@ -2965,6 +2965,21 @@ class Test(NEOThreadedTest): ...@@ -2965,6 +2965,21 @@ class Test(NEOThreadedTest):
for i, s in zip(nid_list, cluster.storage_list): for i, s in zip(nid_list, cluster.storage_list):
self.assertMultiLineEqual(s.dm.dump(), dump_dict[i]) self.assertMultiLineEqual(s.dm.dump(), dump_dict[i])
def testProtocolVersionMismatch(self):
def ConnectorClass(cls, conn, *args):
connector = cls(*args)
x = connector.queued[0]
connector.queued[0] = x[:-1] + chr(ord(x[-1]) ^ 1)
return connector
with Patch(ClientConnection, ConnectorClass=ConnectorClass), \
self.getLoopbackConnection() as conn:
for _ in xrange(9):
if conn.isClosed():
break
conn.em.poll(1)
else:
self.fail('%r not closed' % conn)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment