Commit fa37c321 authored by Vincent Pelletier's avatar Vincent Pelletier

Do not crash when check occurs too early.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2584 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 60cbb2d8
...@@ -21,6 +21,8 @@ from persistent import Persistent ...@@ -21,6 +21,8 @@ from persistent import Persistent
from neo.tests.functional import NEOCluster, NEOFunctionalTest from neo.tests.functional import NEOCluster, NEOFunctionalTest
from neo.protocol import ClusterStates, NodeStates from neo.protocol import ClusterStates, NodeStates
from MySQLdb import ProgrammingError
from MySQLdb.constants.ER import NO_SUCH_TABLE
class PObject(Persistent): class PObject(Persistent):
...@@ -119,8 +121,13 @@ class StorageTests(NEOFunctionalTest): ...@@ -119,8 +121,13 @@ class StorageTests(NEOFunctionalTest):
def __checkReplicateCount(self, db_name, target_count, timeout=0, delay=1): def __checkReplicateCount(self, db_name, target_count, timeout=0, delay=1):
db = self.neo.getSQLConnection(db_name, autocommit=True) db = self.neo.getSQLConnection(db_name, autocommit=True)
def callback(last_try): def callback(last_try):
replicate_count = self.queryCount(db, try:
'select count(distinct uuid) from pt') replicate_count = self.queryCount(db,
'select count(distinct uuid) from pt')
except ProgrammingError, exc:
if exc[0] != NO_SUCH_TABLE:
raise
replicate_count = 0
if last_try is not None and last_try < replicate_count: if last_try is not None and last_try < replicate_count:
raise AssertionError, 'Regression: %s became %s' % \ raise AssertionError, 'Regression: %s became %s' % \
(last_try, replicate_count) (last_try, replicate_count)
......
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