Skip to content

Commit

Permalink
Remove checkFlushNeededAfterTruncate because it can't happen any more
Browse files Browse the repository at this point in the history
because we write on finish. Even if we switch back to writing on vote,
we know checkFlushAfterTruncate checks that we don't have a problem. checkFlushNeededAfterTruncate was mainly needed while we wrote checkFlushAfterTruncate.
  • Loading branch information
Jim Fulton committed Jul 27, 2016
1 parent 41c3e7c commit 3810b42
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/ZODB/tests/testFileStorage.py
Expand Up @@ -286,7 +286,7 @@ def check_record_iternext(self):
else:
self.assertNotEqual(next_oid, None)

def checkFlushAfterTruncate(self, fail=False):
def checkFlushAfterTruncate(self):
r0 = self._dostore(z64)
storage = self._storage
t = transaction.Transaction()
Expand All @@ -301,21 +301,7 @@ def checkFlushAfterTruncate(self, fail=False):
self._dostore(z64, r0, b'bar', 1)
# In the case that read buffers were not invalidated, return value
# is based on what was cached during the first load.
self.assertEqual(load_current(storage, z64)[0],
b'foo' if fail else b'bar')

# We want to be sure that the above test detects any regression
# in the code it checks, because any bug here is like a time bomb: not
# obvious, hard to reproduce, with possible data corruption.
# It's even more important that FilePool.flush() is quite aggressive and
# we'd like to optimize it when Python gets an API to flush read buffers.
# Therefore, 'checkFlushAfterTruncate' is tested in turn by another unit
# test.
# On Windows, flushing explicitely is not (always?) necessary.
if sys.platform != 'win32':
def checkFlushNeededAfterTruncate(self):
self._storage._files.flush = lambda: None
self.checkFlushAfterTruncate(True)
self.assertEqual(load_current(storage, z64)[0], b'bar')

class FileStorageHexTests(FileStorageTests):

Expand Down

0 comments on commit 3810b42

Please sign in to comment.