Page MenuHomeSoftware Heritage

D787.id.diff
No OneTemporary

D787.id.diff

diff --git a/swh/indexer/storage/in_memory.py b/swh/indexer/storage/in_memory.py
--- a/swh/indexer/storage/in_memory.py
+++ b/swh/indexer/storage/in_memory.py
@@ -166,8 +166,7 @@
if conflict_update:
item_ctags = []
else:
- # TODO: this merges old ctags with new ctags. This is
- # pointless, new ctags should replace the old ones.
+ # merge old ctags with new ctags
existing = list(self._content_ctags.get([item['id']]))
item_ctags = [
{
diff --git a/swh/indexer/tests/test_ctags.py b/swh/indexer/tests/test_ctags.py
--- a/swh/indexer/tests/test_ctags.py
+++ b/swh/indexer/tests/test_ctags.py
@@ -107,8 +107,13 @@
- Unknown sha1 in the input list are not indexed
"""
+
+ def get_indexer_results(self, ids):
+ yield from self.idx_storage.content_ctags_get(ids)
+
def setUp(self):
self.indexer = CtagsIndexerTest()
+ self.idx_storage = self.indexer.idx_storage
# Prepare test input
self.id0 = '01c9379dfc33803963d07c1ccc748d3fe4c96bb5'
diff --git a/swh/indexer/tests/test_utils.py b/swh/indexer/tests/test_utils.py
--- a/swh/indexer/tests/test_utils.py
+++ b/swh/indexer/tests/test_utils.py
@@ -659,7 +659,13 @@
class CommonContentIndexerTest:
- def assert_results_ok(self, actual_results, expected_results=None):
+ def get_indexer_results(self, ids):
+ """Override this for indexers that don't have a mock storage."""
+ return self.indexer.idx_storage.state
+
+ def assert_results_ok(self, sha1s, expected_results=None):
+ actual_results = self.get_indexer_results(sha1s)
+
if expected_results is None:
expected_results = self.expected_results
@@ -678,15 +684,12 @@
# when
self.indexer.run(sha1s, policy_update='update-dups')
- actual_results = self.indexer.idx_storage.state
- self.assertTrue(self.indexer.idx_storage.conflict_update)
- self.assert_results_ok(actual_results)
+ self.assert_results_ok(sha1s)
# 2nd pass
self.indexer.run(sha1s, policy_update='ignore-dups')
- self.assertFalse(self.indexer.idx_storage.conflict_update)
- self.assert_results_ok(actual_results)
+ self.assert_results_ok(sha1s)
def test_index_one_unknown_sha1(self):
"""Unknown sha1 are not indexed"""
@@ -696,14 +699,13 @@
# when
self.indexer.run(sha1s, policy_update='update-dups')
- actual_results = self.indexer.idx_storage.state
# then
expected_results = {
k: v for k, v in self.expected_results.items() if k in sha1s
}
- self.assert_results_ok(actual_results, expected_results)
+ self.assert_results_ok(sha1s, expected_results)
class CommonContentIndexerRangeTest:

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 3:17 PM (1 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219244

Event Timeline