diff --git a/conftest.py b/conftest.py --- a/conftest.py +++ b/conftest.py @@ -16,8 +16,12 @@ # loading) collect_ignore = ["swh/indexer/storage/api/wsgi.py"] -# we use the swh_scheduler fixture -pytest_plugins = ["swh.scheduler.pytest_plugin"] +# we use the various swh fixtures +pytest_plugins = [ + "swh.scheduler.pytest_plugin", + "swh.storage.pytest_plugin", + "swh.core.db.pytest_plugin", +] @pytest.fixture(scope="session") diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,4 +1,4 @@ -swh.core[db,http] >= 0.3 +swh.core[db,http] >= 0.9.1 swh.model >= 0.0.15 swh.objstorage >= 0.2.2 swh.scheduler >= 0.5.2 diff --git a/swh/indexer/storage/db.py b/swh/indexer/storage/db.py --- a/swh/indexer/storage/db.py +++ b/swh/indexer/storage/db.py @@ -487,10 +487,10 @@ args.append(last) if mappings is not None: where.append("oim.mappings && %s") - args.append(mappings) + args.append(list(mappings)) if tool_ids is not None: where.append("oim.indexer_configuration_id = ANY(%s)") - args.append(tool_ids) + args.append(list(tool_ids)) if where: query_parts.append("WHERE") query_parts.append(" AND ".join(where)) diff --git a/swh/indexer/tests/conftest.py b/swh/indexer/tests/conftest.py --- a/swh/indexer/tests/conftest.py +++ b/swh/indexer/tests/conftest.py @@ -5,12 +5,15 @@ from datetime import timedelta import os +from os import path from typing import List, Tuple from unittest.mock import patch import pytest import yaml +from swh.core.db.pytest_plugin import postgresql_fact +import swh.indexer from swh.indexer.storage import get_indexer_storage from swh.objstorage.factory import get_objstorage from swh.storage import get_storage @@ -24,6 +27,14 @@ ] +SQL_FILES = path.join(path.dirname(swh.indexer.__file__), "sql", "*.sql") + + +idx_storage_postgresql = postgresql_fact( + "postgresql_proc", db_name="indexer_storage", dump_files=SQL_FILES, +) + + @pytest.fixture def indexer_scheduler(swh_scheduler): # Insert the expected task types within the scheduler @@ -43,37 +54,63 @@ @pytest.fixture -def idx_storage(): +def idx_storage_backend_config(idx_storage_postgresql): + """Basic pg storage configuration with no journal collaborator for the indexer + storage (to avoid pulling optional dependency on clients of this fixture) + + """ + return { + "cls": "local", + "db": idx_storage_postgresql.dsn, + } + + +@pytest.fixture +def swh_indexer_config( + swh_storage_backend_config, idx_storage_backend_config, swh_scheduler_config +): + return { + "storage": swh_storage_backend_config, + "objstorage": {"cls": "memory"}, + "indexer_storage": idx_storage_backend_config, + "scheduler": {"cls": "local", **swh_scheduler_config}, + "tools": { + "name": "file", + "version": "1:5.30-1+deb9u1", + "configuration": {"type": "library", "debian-package": "python3-magic"}, + }, + "compute_checksums": ["blake2b512"], # for rehash indexer + } + + +@pytest.fixture +def idx_storage(swh_indexer_config): """An instance of in-memory indexer storage that gets injected into all indexers classes. """ - idx_storage = get_indexer_storage("memory") - with patch("swh.indexer.storage.in_memory.IndexerStorage") as idx_storage_mock: - idx_storage_mock.return_value = idx_storage - yield idx_storage + idx_storage_config = swh_indexer_config["indexer_storage"] + return get_indexer_storage(**idx_storage_config) @pytest.fixture -def storage(): +def storage(swh_indexer_config): """An instance of in-memory storage that gets injected into all indexers classes. """ - storage = get_storage(cls="memory") + storage = get_storage(**swh_indexer_config["storage"]) fill_storage(storage) - with patch("swh.storage.in_memory.InMemoryStorage") as storage_mock: - storage_mock.return_value = storage - yield storage + return storage @pytest.fixture -def obj_storage(): +def obj_storage(swh_indexer_config): """An instance of in-memory objstorage that gets injected into all indexers classes. """ - objstorage = get_objstorage("memory") + objstorage = get_objstorage(**swh_indexer_config["objstorage"]) fill_obj_storage(objstorage) with patch.dict( "swh.objstorage.factory._STORAGE_CLASSES", {"memory": lambda: objstorage} @@ -81,21 +118,6 @@ yield objstorage -@pytest.fixture -def swh_indexer_config(): - return { - "storage": {"cls": "memory"}, - "objstorage": {"cls": "memory"}, - "indexer_storage": {"cls": "memory"}, - "tools": { - "name": "file", - "version": "1:5.30-1+deb9u1", - "configuration": {"type": "library", "debian-package": "python3-magic"}, - }, - "compute_checksums": ["blake2b512"], # for rehash indexer - } - - @pytest.fixture def swh_config(swh_indexer_config, monkeypatch, tmp_path): conffile = os.path.join(str(tmp_path), "indexer.yml") diff --git a/swh/indexer/tests/test_cli.py b/swh/indexer/tests/test_cli.py --- a/swh/indexer/tests/test_cli.py +++ b/swh/indexer/tests/test_cli.py @@ -5,7 +5,6 @@ from functools import reduce import re -import tempfile from typing import Any, Dict, List from unittest.mock import patch @@ -22,16 +21,6 @@ from swh.journal.serializers import value_to_kafka from swh.model.hashutil import hash_to_bytes -CLI_CONFIG = """ -scheduler: - cls: foo - args: {} -storage: - cls: memory -indexer_storage: - cls: memory -""" - def fill_idx_storage(idx_storage: IndexerStorageInterface, nb_rows: int) -> List[int]: tools: List[Dict[str, Any]] = [ @@ -43,7 +32,7 @@ origin_metadata = [ OriginIntrinsicMetadataRow( id="file://dev/%04d" % origin_id, - from_revision=hash_to_bytes("abcd{:0>4}".format(origin_id)), + from_revision=hash_to_bytes("abcd{:0>36}".format(origin_id)), indexer_configuration_id=tools[origin_id % 2]["id"], metadata={"name": "origin %d" % origin_id}, mappings=["mapping%d" % (origin_id % 10)], @@ -52,7 +41,7 @@ ] revision_metadata = [ RevisionIntrinsicMetadataRow( - id=hash_to_bytes("abcd{:0>4}".format(origin_id)), + id=hash_to_bytes("abcd{:0>36}".format(origin_id)), indexer_configuration_id=tools[origin_id % 2]["id"], metadata={"name": "origin %d" % origin_id}, mappings=["mapping%d" % (origin_id % 10)], @@ -83,25 +72,17 @@ assert _origins_in_task_args(tasks) == set(["file://dev/%04d" % i for i in origins]) -def invoke(scheduler, catch_exceptions, args): - runner = CliRunner() - with patch( - "swh.scheduler.get_scheduler" - ) as get_scheduler_mock, tempfile.NamedTemporaryFile( - "a", suffix=".yml" - ) as config_fd: - config_fd.write(CLI_CONFIG) - config_fd.seek(0) - get_scheduler_mock.return_value = scheduler - result = runner.invoke(indexer_cli_group, ["-C" + config_fd.name] + args) - if not catch_exceptions and result.exception: - print(result.output) - raise result.exception - return result - - -def test_mapping_list(indexer_scheduler): - result = invoke(indexer_scheduler, False, ["mapping", "list",]) +@pytest.fixture +def cli_runner(): + return CliRunner() + + +def test_cli_mapping_list(cli_runner, swh_config): + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "mapping", "list"], + catch_exceptions=False, + ) expected_output = "\n".join( ["codemeta", "gemspec", "maven", "npm", "pkg-info", "",] ) @@ -109,8 +90,12 @@ assert result.output == expected_output -def test_mapping_list_terms(indexer_scheduler): - result = invoke(indexer_scheduler, False, ["mapping", "list-terms",]) +def test_cli_mapping_list_terms(cli_runner, swh_config): + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "mapping", "list-terms"], + catch_exceptions=False, + ) assert result.exit_code == 0, result.output assert re.search(r"http://schema.org/url:\n.*npm", result.output) assert re.search(r"http://schema.org/url:\n.*codemeta", result.output) @@ -120,11 +105,11 @@ ) -def test_mapping_list_terms_exclude(indexer_scheduler): - result = invoke( - indexer_scheduler, - False, - ["mapping", "list-terms", "--exclude-mapping", "codemeta"], +def test_cli_mapping_list_terms_exclude(cli_runner, swh_config): + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "mapping", "list-terms", "--exclude-mapping", "codemeta"], + catch_exceptions=False, ) assert result.exit_code == 0, result.output assert re.search(r"http://schema.org/url:\n.*npm", result.output) @@ -137,8 +122,14 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_empty_db(indexer_scheduler, idx_storage, storage): - result = invoke(indexer_scheduler, False, ["schedule", "reindex_origin_metadata",]) +def test_cli_origin_metadata_reindex_empty_db( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage +): + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "schedule", "reindex_origin_metadata",], + catch_exceptions=False, + ) expected_output = "Nothing to do (no origin metadata matched the criteria).\n" assert result.exit_code == 0, result.output assert result.output == expected_output @@ -148,12 +139,18 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_divisor(indexer_scheduler, idx_storage, storage): +def test_cli_origin_metadata_reindex_divisor( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage +): """Tests the re-indexing when origin_batch_size*task_batch_size is a divisor of nb_origins.""" fill_idx_storage(idx_storage, 90) - result = invoke(indexer_scheduler, False, ["schedule", "reindex_origin_metadata",]) + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "schedule", "reindex_origin_metadata",], + catch_exceptions=False, + ) # Check the output expected_output = ( @@ -173,13 +170,17 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_dry_run(indexer_scheduler, idx_storage, storage): +def test_cli_origin_metadata_reindex_dry_run( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage +): """Tests the re-indexing when origin_batch_size*task_batch_size is a divisor of nb_origins.""" fill_idx_storage(idx_storage, 90) - result = invoke( - indexer_scheduler, False, ["schedule", "--dry-run", "reindex_origin_metadata",] + result = cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "schedule", "--dry-run", "reindex_origin_metadata",], + catch_exceptions=False, ) # Check the output @@ -199,15 +200,24 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_nondivisor(indexer_scheduler, idx_storage, storage): +def test_cli_origin_metadata_reindex_nondivisor( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage +): """Tests the re-indexing when neither origin_batch_size or task_batch_size is a divisor of nb_origins.""" fill_idx_storage(idx_storage, 70) - result = invoke( - indexer_scheduler, - False, - ["schedule", "reindex_origin_metadata", "--batch-size", "20",], + result = cli_runner.invoke( + indexer_cli_group, + [ + "-C", + swh_config, + "schedule", + "reindex_origin_metadata", + "--batch-size", + "20", + ], + catch_exceptions=False, ) # Check the output @@ -227,17 +237,24 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_filter_one_mapping( - indexer_scheduler, idx_storage, storage +def test_cli_origin_metadata_reindex_filter_one_mapping( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage ): """Tests the re-indexing when origin_batch_size*task_batch_size is a divisor of nb_origins.""" fill_idx_storage(idx_storage, 110) - result = invoke( - indexer_scheduler, - False, - ["schedule", "reindex_origin_metadata", "--mapping", "mapping1",], + result = cli_runner.invoke( + indexer_cli_group, + [ + "-C", + swh_config, + "schedule", + "reindex_origin_metadata", + "--mapping", + "mapping1", + ], + catch_exceptions=False, ) # Check the output @@ -253,17 +270,18 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_filter_two_mappings( - indexer_scheduler, idx_storage, storage +def test_cli_origin_metadata_reindex_filter_two_mappings( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage ): """Tests the re-indexing when origin_batch_size*task_batch_size is a divisor of nb_origins.""" fill_idx_storage(idx_storage, 110) - result = invoke( - indexer_scheduler, - False, + result = cli_runner.invoke( + indexer_cli_group, [ + "--config-file", + swh_config, "schedule", "reindex_origin_metadata", "--mapping", @@ -271,6 +289,7 @@ "--mapping", "mapping2", ], + catch_exceptions=False, ) # Check the output @@ -312,17 +331,24 @@ @patch("swh.scheduler.cli.utils.TASK_BATCH_SIZE", 3) @patch("swh.scheduler.cli_utils.TASK_BATCH_SIZE", 3) -def test_origin_metadata_reindex_filter_one_tool( - indexer_scheduler, idx_storage, storage +def test_cli_origin_metadata_reindex_filter_one_tool( + cli_runner, swh_config, indexer_scheduler, idx_storage, storage ): """Tests the re-indexing when origin_batch_size*task_batch_size is a divisor of nb_origins.""" tool_ids = fill_idx_storage(idx_storage, 110) - result = invoke( - indexer_scheduler, - False, - ["schedule", "reindex_origin_metadata", "--tool-id", str(tool_ids[0]),], + result = cli_runner.invoke( + indexer_cli_group, + [ + "-C", + swh_config, + "schedule", + "reindex_origin_metadata", + "--tool-id", + str(tool_ids[0]), + ], + catch_exceptions=False, ) # Check the output @@ -340,8 +366,13 @@ _assert_tasks_for_origins(tasks, [x * 2 for x in range(55)]) -def test_journal_client( - storage, indexer_scheduler, kafka_prefix: str, kafka_server, consumer: Consumer +def test_cli_journal_client( + cli_runner, + swh_config, + indexer_scheduler, + kafka_prefix: str, + kafka_server, + consumer: Consumer, ): """Test the 'swh indexer journal-client' cli tool.""" producer = Producer( @@ -359,10 +390,11 @@ value=value_to_kafka(STATUS), ) - result = invoke( - indexer_scheduler, - False, + result = cli_runner.invoke( + indexer_cli_group, [ + "-C", + swh_config, "journal-client", "--stop-after-objects", "1", @@ -373,6 +405,7 @@ "--group-id", "test-consumer", ], + catch_exceptions=False, ) # Check the output @@ -386,12 +419,14 @@ _assert_tasks_for_origins(tasks, [0]) -def test_journal_client_without_brokers( - storage, indexer_scheduler, kafka_prefix: str, kafka_server, consumer: Consumer +def test_cli_journal_client_without_brokers( + cli_runner, swh_config, kafka_prefix: str, kafka_server, consumer: Consumer ): """Without brokers configuration, the cli fails.""" with pytest.raises(ValueError, match="brokers"): - invoke( - indexer_scheduler, False, ["journal-client",], + cli_runner.invoke( + indexer_cli_group, + ["-C", swh_config, "journal-client",], + catch_exceptions=False, ) diff --git a/swh/indexer/tests/test_origin_head.py b/swh/indexer/tests/test_origin_head.py --- a/swh/indexer/tests/test_origin_head.py +++ b/swh/indexer/tests/test_origin_head.py @@ -50,6 +50,14 @@ self.results = results +SAMPLE_SNAPSHOT = Snapshot( + branches={ + b"foo": None, + b"HEAD": SnapshotBranch(target_type=TargetType.ALIAS, target=b"foo",), + }, +) + + class OriginHead(unittest.TestCase): @pytest.fixture(autouse=True) def init(self, swh_config): @@ -79,24 +87,13 @@ ) ] )[0] - self.indexer.storage.snapshot_add( - [ - Snapshot( - branches={ - b"foo": None, - b"HEAD": SnapshotBranch( - target_type=TargetType.ALIAS, target=b"foo", - ), - }, - ), - ] - ) + self.indexer.storage.snapshot_add([SAMPLE_SNAPSHOT]) visit_status = OriginVisitStatus( origin=origin_url, visit=visit.visit, date=now(), status="partial", - snapshot=b"foo", + snapshot=SAMPLE_SNAPSHOT.id, ) self.indexer.storage.origin_visit_status_add([visit_status]) self.indexer.run([origin_url]) @@ -120,24 +117,13 @@ ) ] )[0] - self.indexer.storage.snapshot_add( - [ - Snapshot( - branches={ - b"foo": None, - b"HEAD": SnapshotBranch( - target_type=TargetType.ALIAS, target=b"foo", - ), - }, - ) - ] - ) + self.indexer.storage.snapshot_add([SAMPLE_SNAPSHOT]) visit_status = OriginVisitStatus( origin=origin_url, visit=visit.visit, date=now(), status="full", - snapshot=b"foo", + snapshot=SAMPLE_SNAPSHOT.id, ) self.indexer.storage.origin_visit_status_add([visit_status]) self.indexer.run(["https://pypi.org/project/abcdef/"]) diff --git a/swh/indexer/tests/test_origin_metadata.py b/swh/indexer/tests/test_origin_metadata.py --- a/swh/indexer/tests/test_origin_metadata.py +++ b/swh/indexer/tests/test_origin_metadata.py @@ -3,8 +3,11 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information +import copy from unittest.mock import patch +import pytest + from swh.indexer.metadata import OriginMetadataIndexer from swh.indexer.storage.interface import IndexerStorageInterface from swh.indexer.storage.model import ( @@ -14,23 +17,31 @@ from swh.model.model import Origin from swh.storage.interface import StorageInterface -from .test_metadata import REVISION_METADATA_CONFIG +from .test_metadata import TRANSLATOR_TOOL from .utils import REVISION, YARN_PARSER_METADATA +@pytest.fixture +def swh_indexer_config(swh_indexer_config): + """Override the default configuration to override the tools entry + + """ + cfg = copy.deepcopy(swh_indexer_config) + cfg["tools"] = TRANSLATOR_TOOL + return cfg + + def test_origin_metadata_indexer( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) origin = "https://github.com/librariesio/yarn-parser" indexer.run([origin]) - tool = { - "name": "swh-metadata-translator", - "version": "0.0.2", - "configuration": {"context": "NpmMapping", "type": "local"}, - } + tool = swh_indexer_config["tools"] rev_id = REVISION.id rev_metadata = RevisionIntrinsicMetadataRow( @@ -44,13 +55,13 @@ mappings=["npm"], ) - rev_results = list(indexer.idx_storage.revision_intrinsic_metadata_get([rev_id])) + rev_results = list(idx_storage.revision_intrinsic_metadata_get([rev_id])) for rev_result in rev_results: assert rev_result.tool del rev_result.tool["id"] assert rev_results == [rev_metadata] - orig_results = list(indexer.idx_storage.origin_intrinsic_metadata_get([origin])) + orig_results = list(idx_storage.origin_intrinsic_metadata_get([origin])) for orig_result in orig_results: assert orig_result.tool del orig_result.tool["id"] @@ -58,9 +69,12 @@ def test_origin_metadata_indexer_duplicate_origin( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) indexer.storage = storage indexer.idx_storage = idx_storage indexer.run(["https://github.com/librariesio/yarn-parser"]) @@ -77,11 +91,14 @@ def test_origin_metadata_indexer_missing_head( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: storage.origin_add([Origin(url="https://example.com")]) - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) indexer.run(["https://example.com"]) origin = "https://example.com" @@ -91,13 +108,16 @@ def test_origin_metadata_indexer_partial_missing_head( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: origin1 = "https://example.com" origin2 = "https://github.com/librariesio/yarn-parser" storage.origin_add([Origin(url=origin1)]) - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) indexer.run([origin1, origin2]) rev_id = REVISION.id @@ -128,9 +148,12 @@ def test_origin_metadata_indexer_duplicate_revision( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) indexer.storage = storage indexer.idx_storage = idx_storage indexer.catch_exceptions = False @@ -150,10 +173,13 @@ def test_origin_metadata_indexer_no_metadata_file( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) origin = "https://github.com/librariesio/yarn-parser" with patch("swh.indexer.metadata_dictionary.npm.NpmMapping.filename", b"foo.json"): indexer.run([origin]) @@ -168,10 +194,13 @@ def test_origin_metadata_indexer_no_metadata( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) origin = "https://github.com/librariesio/yarn-parser" with patch( "swh.indexer.metadata.RevisionMetadataIndexer" @@ -190,10 +219,13 @@ def test_origin_metadata_indexer_error( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) origin = "https://github.com/librariesio/yarn-parser" with patch( "swh.indexer.metadata.RevisionMetadataIndexer" @@ -212,9 +244,12 @@ def test_origin_metadata_indexer_unknown_origin( - idx_storage: IndexerStorageInterface, storage: StorageInterface, obj_storage + swh_indexer_config, + idx_storage: IndexerStorageInterface, + storage: StorageInterface, + obj_storage, ) -> None: - indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) + indexer = OriginMetadataIndexer(config=swh_indexer_config) result = indexer.index_list(["https://unknown.org/foo"]) assert not result