diff --git a/test/integration/objectstore/test_remote_objectstore_cache_operations.py b/test/integration/objectstore/test_remote_objectstore_cache_operations.py index 8e7d396c398..e6d114234de 100644 --- a/test/integration/objectstore/test_remote_objectstore_cache_operations.py +++ b/test/integration/objectstore/test_remote_objectstore_cache_operations.py @@ -20,6 +20,13 @@ class CacheOperationTestCase(BaseSwiftObjectStoreIntegrationTestCase): hda = self.dataset_populator.new_dataset(history_id, content="123", wait=True) return hda + def upload_bam_dataset(self): + history_id = self.dataset_populator.new_history() + hda = self.dataset_populator.new_dataset( + history_id, content=open(self.test_data_resolver.get_filename("1.bam"), "rb"), file_type="bam", wait=True + ) + return hda + def test_cache_populated(self): self.upload_dataset() assert files_count(self.object_store_cache_path) == 1 @@ -34,6 +41,23 @@ class CacheOperationTestCase(BaseSwiftObjectStoreIntegrationTestCase): assert content == "123\n" assert files_count(self.object_store_cache_path) == 1 + def test_cache_repopulated_metadata_file(self): + hda = self.upload_bam_dataset() + assert files_count(self.object_store_cache_path) == 2 + response = self._get( + f'histories/{hda["history_id"]}/contents/{hda["id"]}/metadata_file?metadata_name=bam_index' + ) + assert len(response.content) > 0 + response.raise_for_status() + shutil.rmtree(self.object_store_cache_path) + assert files_count(self.object_store_cache_path) == 0 + response = self._get( + f'histories/{hda["history_id"]}/contents/{hda["id"]}/metadata_file?metadata_name=bam_index' + ) + response.raise_for_status() + assert files_count(self.object_store_cache_path) == 1 + assert len(response.content) > 0 + def test_delete_item_not_in_cache(self): hda = self.upload_dataset() assert files_count(self.object_store_cache_path) == 1