Commit a4eca036 authored by Jim Fulton's avatar Jim Fulton

fixed more tests

parent c536ed31
...@@ -45,23 +45,10 @@ class TestClientStorage(ClientStorage): ...@@ -45,23 +45,10 @@ class TestClientStorage(ClientStorage):
connection_count_for_tests = 0 connection_count_for_tests = 0
def notifyConnected(self, conn): def notify_connected(self, conn, info):
ClientStorage.notifyConnected(self, conn) ClientStorage.notify_connected(self, conn, info)
self.connection_count_for_tests += 1 self.connection_count_for_tests += 1
self.verify_result = conn.verify_result
def verify_cache(self, stub):
self.end_verify = threading.Event()
self.verify_result = ClientStorage.verify_cache(self, stub)
def endVerify(self):
ClientStorage.endVerify(self)
self.end_verify.set()
def testConnection(self, conn):
try:
return ClientStorage.testConnection(self, conn)
finally:
self.test_connection = True
class DummyDB: class DummyDB:
def invalidate(self, *args, **kwargs): def invalidate(self, *args, **kwargs):
...@@ -658,13 +645,7 @@ class InvqTests(CommonSetupTearDown): ...@@ -658,13 +645,7 @@ class InvqTests(CommonSetupTearDown):
revid = self._dostore(oid, revid) revid = self._dostore(oid, revid)
perstorage = self.openClientStorage(cache="test") perstorage = self.openClientStorage(cache="test")
self.assertEqual(perstorage.verify_result, "full verification") self.assertEqual(perstorage.verify_result, "cache too old, clearing")
t = time.time() + 30
while not perstorage.end_verify.isSet():
perstorage.sync()
if time.time() > t:
self.fail("timed out waiting for endVerify")
self.assertEqual(self._storage.load(oid, '')[1], revid) self.assertEqual(self._storage.load(oid, '')[1], revid)
self.assertEqual(perstorage.load(oid, ''), self.assertEqual(perstorage.load(oid, ''),
self._storage.load(oid, '')) self._storage.load(oid, ''))
...@@ -800,8 +781,9 @@ class ReconnectionTests(CommonSetupTearDown): ...@@ -800,8 +781,9 @@ class ReconnectionTests(CommonSetupTearDown):
self._servers = [] self._servers = []
# Poll until the client disconnects # Poll until the client disconnects
self.pollDown() self.pollDown()
# Stores should fail now
self.assertRaises(ClientDisconnected, self._dostore) # Accesses should fail now
self.assertRaises(ClientDisconnected, self._storage.history, ZERO)
# Restart the server, this time read-write # Restart the server, this time read-write
self.startServer(create=0, keep=0) self.startServer(create=0, keep=0)
...@@ -855,7 +837,7 @@ class ReconnectionTests(CommonSetupTearDown): ...@@ -855,7 +837,7 @@ class ReconnectionTests(CommonSetupTearDown):
self.pollUp() self.pollUp()
# There were no transactions committed, so no verification # There were no transactions committed, so no verification
# should be needed. # should be needed.
self.assertEqual(self._storage.verify_result, "no verification") self.assertEqual(self._storage.verify_result, "Cache up to date")
def checkNoVerificationOnServerRestartWith2Clients(self): def checkNoVerificationOnServerRestartWith2Clients(self):
perstorage = self.openClientStorage(cache="test") perstorage = self.openClientStorage(cache="test")
...@@ -886,8 +868,8 @@ class ReconnectionTests(CommonSetupTearDown): ...@@ -886,8 +868,8 @@ class ReconnectionTests(CommonSetupTearDown):
self.pollUp(storage=perstorage) self.pollUp(storage=perstorage)
# There were no transactions committed, so no verification # There were no transactions committed, so no verification
# should be needed. # should be needed.
self.assertEqual(self._storage.verify_result, "no verification") self.assertEqual(self._storage.verify_result, "Cache up to date")
self.assertEqual(perstorage.verify_result, "no verification") self.assertEqual(perstorage.verify_result, "Cache up to date")
perstorage.close() perstorage.close()
self._storage.close() self._storage.close()
...@@ -902,9 +884,8 @@ class ReconnectionTests(CommonSetupTearDown): ...@@ -902,9 +884,8 @@ class ReconnectionTests(CommonSetupTearDown):
self._storage.store(oid, None, data, '', txn) self._storage.store(oid, None, data, '', txn)
self.shutdownServer() self.shutdownServer()
self.assertRaises(ClientDisconnected, self._storage.tpc_vote, txn) self.assertRaises(ClientDisconnected, self._storage.tpc_vote, txn)
self._storage.tpc_abort(txn)
self.startServer(create=0) self.startServer(create=0)
self._storage._wait() self._storage.tpc_abort(txn)
self._dostore() self._dostore()
# This test is supposed to cover the following error, although # This test is supposed to cover the following error, although
......
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