fix test_vdrive (fixes #144)
authorZooko O'Whielacronx <zooko@zooko.com>
Sat, 22 Sep 2007 22:26:27 +0000 (15:26 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sat, 22 Sep 2007 22:26:27 +0000 (15:26 -0700)
It turns out that we actually have *two* files in our storage servers at the
time that test_vdrive asserts things about the shares.  I suppose that
test_vdrive happens to pass on all other operating systems because the
filesystem happens to return the right share as the first one in a
"listdir()".  The fix in this patch is slightly kludgey -- allow either share
to pass -- but good enough.

src/allmydata/test/test_system.py

index b3e57ca183971ae3df0816a0a3afc1f0d5112128..092accaf32f0d6ba69a53af61b876f54af68066e 100644 (file)
@@ -639,13 +639,19 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
         output = out.getvalue()
         self.failUnlessEqual(rc, 0)
 
-        # we only upload a single file, so we can assert some things about
-        # its size and shares
-        self.failUnless("size: %d\n" % len(self.data) in output)
-        self.failUnless("num_segments: 1\n" in output)
-        # segment_size is always a multiple of needed_shares
-        self.failUnless("segment_size: 114\n" in output)
-        self.failUnless("total_shares: 10\n" in output)
+        # We've uploaded only two files so we can assert some things
+        # about the size and shares.
+        self.failUnless("size: 112\n" in output or "size: 1500000\n" in output)
+        if "size: 112\n" in output:
+            self.failUnless("num_segments: 1\n" in output)
+            # segment_size is always a multiple of needed_shares
+            self.failUnless("segment_size: 114\n" in output)
+            self.failUnless("total_shares: 10\n" in output)
+        else:
+            self.failUnless("num_segments: 2\n" in output)
+            # segment_size is always a multiple of needed_shares
+            self.failUnless("segment_size: 1048578\n" in output)
+            self.failUnless("total_shares: 10\n" in output)
         # keys which are supposed to be present
         for key in ("size", "num_segments", "segment_size",
                     "needed_shares", "total_shares",