Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/tests/test_provenance_storage_rabbitmq.py
# Copyright (C) 2021-2022 The Software Heritage developers | |||||
# See the AUTHORS file at the top-level directory of this distribution | |||||
# License: GNU General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
from typing import Any, Dict, Generator | from typing import Any, Dict, Generator | ||||
import pytest | import pytest | ||||
from swh.provenance import get_provenance_storage | from swh.provenance import get_provenance_storage | ||||
from swh.provenance.interface import ProvenanceStorageInterface | from swh.provenance.storage.interface import ProvenanceStorageInterface | ||||
from .test_provenance_storage import TestProvenanceStorage # noqa: F401 | from .test_provenance_storage import TestProvenanceStorage # noqa: F401 | ||||
@pytest.fixture() | @pytest.fixture() | ||||
def provenance_storage( | def provenance_storage( | ||||
provenance_postgresqldb: Dict[str, str], | provenance_postgresqldb: Dict[str, str], | ||||
rabbitmq, | rabbitmq, | ||||
) -> Generator[ProvenanceStorageInterface, None, None]: | ) -> Generator[ProvenanceStorageInterface, None, None]: | ||||
"""Return a working and initialized ProvenanceStorageInterface object""" | """Return a working and initialized ProvenanceStorageInterface object""" | ||||
from swh.provenance.api.server import ProvenanceStorageRabbitMQServer | from swh.provenance.storage.rabbitmq.server import ProvenanceStorageRabbitMQServer | ||||
host = rabbitmq.args["host"] | host = rabbitmq.args["host"] | ||||
port = rabbitmq.args["port"] | port = rabbitmq.args["port"] | ||||
rabbitmq_params: Dict[str, Any] = { | rabbitmq_params: Dict[str, Any] = { | ||||
"url": f"amqp://guest:guest@{host}:{port}/%2f", | "url": f"amqp://guest:guest@{host}:{port}/%2f", | ||||
"storage_config": { | "storage_config": { | ||||
"cls": "postgresql", | "cls": "postgresql", | ||||
"db": provenance_postgresqldb, | "db": provenance_postgresqldb, | ||||
Show All 12 Lines |