From 91c4f88860efa5f7d11d9cd6436ab30d78a83ab1 Mon Sep 17 00:00:00 2001 From: Steven Berler Date: Wed, 13 Jul 2011 13:50:26 -0700 Subject: [PATCH] fix random file verifier with small files The file verifier will now correctly verify small files (smaller than the md5 digest size), as long as the data that is there matches what the digest would be. --- s3tests/realistic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/s3tests/realistic.py b/s3tests/realistic.py index 36abf44..e5d234b 100644 --- a/s3tests/realistic.py +++ b/s3tests/realistic.py @@ -78,6 +78,9 @@ class FileVerifier(object): Returns True if this file looks valid. The file is valid if the end of the file has the md5 digest for the first part of the file. """ + if self.size < self.hash.digest_size: + return self.hash.digest().startswith(self.buf) + return self.buf == self.hash.digest() def files(mean, stddev, seed=None):