Created
April 14, 2015 02:27
-
-
Save clayg/d47fba5611e9eeeec5b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py | |
index 1c51a59..20570fe 100644 | |
--- a/test/unit/obj/test_diskfile.py | |
+++ b/test/unit/obj/test_diskfile.py | |
@@ -3550,6 +3550,48 @@ class TestECDiskFile(DiskFileMixin, unittest.TestCase): | |
# no effect | |
self.assertEqual(sorted(os.listdir(df._datadir)), []) | |
+ def test_open_most_recent_missing_durable(self): | |
+ policy = POLICIES.default | |
+ df_mgr = self.df_router[policy] | |
+ | |
+ df = df_mgr.get_diskfile(self.existing_device, '0', | |
+ 'a', 'c', 'o', policy=policy) | |
+ | |
+ self.assertRaises(DiskFileNotExist, df.read_metadata) | |
+ | |
+ # now create a datafile missing durable | |
+ ts = self.ts() | |
+ with df.create() as writer: | |
+ data = 'test data' | |
+ writer.write(data) | |
+ new_metadata = { | |
+ 'ETag': md5(data).hexdigest(), | |
+ 'X-Timestamp': ts.internal, | |
+ 'Content-Length': len(data), | |
+ 'X-Object-Sysmeta-Ec-Archive-Index': 3, | |
+ } | |
+ writer.put(new_metadata) | |
+ # N.B. don't make it durable | |
+ | |
+ # add some .meta stuff | |
+ extra_meta = { | |
+ 'X-Object-Meta-Foo': 'Bar', | |
+ 'X-Timestamp': self.ts().internal, | |
+ } | |
+ df = df_mgr.get_diskfile(self.existing_device, '0', | |
+ 'a', 'c', 'o', policy=policy) | |
+ df.write_metadata(extra_meta) | |
+ | |
+ # we still get the DiskFileNotExist (same as if no .data!) | |
+ df = df_mgr.get_diskfile(self.existing_device, '0', | |
+ 'a', 'c', 'o', policy=policy, | |
+ frag_index=3) | |
+ self.assertRaises(DiskFileNotExist, df.read_metadata) | |
+ | |
+ df = df_mgr.get_diskfile(self.existing_device, '0', | |
+ 'a', 'c', 'o', policy=policy) | |
+ self.assertRaises(DiskFileNotExist, df.read_metadata) | |
+ | |
@patch_policies(with_ec_default=True) | |
class TestSuffixHashes(unittest.TestCase): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment