-
-
Save alistairncoles/7fa16e567cbacd12a7a6 to your computer and use it in GitHub Desktop.
you gotta make the obj dir files consistent
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 2d1f08f..57e3a5a 100644 | |
--- a/test/unit/obj/test_diskfile.py | |
+++ b/test/unit/obj/test_diskfile.py | |
@@ -2859,6 +2859,36 @@ class DiskFileMixin(BaseDiskFileTestMixin): | |
self.assertTrue(exp_name in set(dl), | |
'Expected file %s not found in %s' % (exp_name, dl)) | |
+ def test_rollup_multiple_meta_files_into_one(self): | |
+ # a newer file without content-type and an older meta file with | |
+ # content-type should be rolled up into a single meta file | |
+ ts_iter = make_timestamp_iter() | |
+ df = self._create_test_file('1234567890', timestamp=ts_iter.next()) | |
+ file_count = len(os.listdir(df._datadir)) | |
+ timestamp = ts_iter.next() | |
+ timestamp2 = ts_iter.next() | |
+ metadata = {'X-Timestamp': timestamp2.internal, | |
+ 'X-Object-Meta-test': 'old_data', | |
+ 'Content-Type': 'foo', | |
+ 'Content-Type-Timestamp': timestamp.internal} | |
+ df.write_metadata(metadata) | |
+ timestamp3 = ts_iter.next() | |
+ metadata = {'X-Timestamp': timestamp3.internal, | |
+ 'X-Object-Meta-test': 'data'} | |
+ df.write_metadata(metadata) | |
+ # we added timestamp3.meta and timestamp2-delta.meta | |
+ dl = os.listdir(df._datadir) | |
+ self.assertEqual(len(dl), file_count + 2, dl) | |
+ | |
+ # cleanup should roll the two meta files into one | |
+ dl = df.manager.hash_cleanup_listdir(df._datadir) | |
+ | |
+ self.assertEqual(len(dl), file_count + 1, dl) | |
+ exp_name = '%s-%x.meta' % (timestamp3.internal, | |
+ timestamp3.raw - timestamp.raw) | |
+ self.assertTrue(exp_name in set(dl), | |
+ 'Expected file %s not found in %s' % (exp_name, dl)) | |
+ | |
def test_write_metadata_no_xattr(self): | |
timestamp = Timestamp(time()).internal | |
metadata = {'X-Timestamp': timestamp, 'X-Object-Meta-test': 'data'} | |
diff --git a/test/unit/obj/test_ssync_sender.py b/test/unit/obj/test_ssync_sender.py | |
index 6fbd96f..974b9d2 100644 | |
--- a/test/unit/obj/test_ssync_sender.py | |
+++ b/test/unit/obj/test_ssync_sender.py | |
@@ -2606,7 +2606,7 @@ class TestSsyncReplication(TestBaseSsync): | |
metadata = df.get_metadata() | |
self.assertEqual(metadata['X-Object-Meta-Test'], oname) | |
self.assertEqual(metadata['Content-Type'], 'text/test') | |
- self._verify_ondisk_dir_listing(['o5'], policy) | |
+ self._verify_ondisk_dir_listing(tx_objs.keys(), policy) | |
class TestModuleMethods(unittest.TestCase): |
Author
alistairncoles
commented
Nov 6, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment