Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123905
D6339.id23189.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D6339.id23189.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,13 @@
*.csv
+*.dump
*.egg*
*.log
+*.mypy*
*.prof
*.zip
*.orig
*.bak
-.coverage
+.coverage*
.tox
.vscode
__pycache__
diff --git a/pytest.ini b/pytest.ini
--- a/pytest.ini
+++ b/pytest.ini
@@ -4,3 +4,8 @@
mongodb_fixture_dir = swh/provenance/tests/data/mongo
mongodb_engine = mongomock
mongodb_dbname = test
+
+postgresql_postgres_options = -N 500
+
+rabbitmq_host = localhost
+rabbitmq_port = 5672
diff --git a/requirements-test.txt b/requirements-test.txt
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,4 +1,5 @@
pytest
pytest-mongodb
+pytest-rabbitmq
swh.loader.git >= 0.8
swh.journal >= 0.8
diff --git a/swh/provenance/tests/conftest.py b/swh/provenance/tests/conftest.py
--- a/swh/provenance/tests/conftest.py
+++ b/swh/provenance/tests/conftest.py
@@ -44,7 +44,7 @@
return postgresql.get_dsn_parameters()
-@pytest.fixture(params=["mongodb", "postgresql"])
+@pytest.fixture(params=["mongodb", "postgresql", "rabbitmq"])
def provenance_storage(
request: SubRequest,
provenance_postgresqldb: Dict[str, str],
@@ -65,6 +65,29 @@
yield mongodb_storage
mongodb_storage.close()
+ elif request.param == "rabbitmq":
+ from swh.provenance.api.server import ProvenanceStorageRabbitMQServer
+
+ request.getfixturevalue("rabbitmq") # loaded to ensure server is up
+ rabbitmq_params: Dict[str, Any] = {
+ "url": "amqp://guest:guest@localhost:5672/%2f",
+ "storage_config": {
+ "cls": "postgresql", # TODO: also test with underlying mongodb storage
+ "db": provenance_postgresqldb,
+ "raise_on_commit": True,
+ },
+ }
+ client = get_provenance_storage(cls=request.param, **rabbitmq_params)
+ server = ProvenanceStorageRabbitMQServer(
+ url=rabbitmq_params["url"], storage_config=rabbitmq_params["storage_config"]
+ )
+
+ server.start()
+ client.open()
+ yield client
+ client.close()
+ server.stop()
+
else:
# in test sessions, we DO want to raise any exception occurring at commit time
storage = get_provenance_storage(
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist=black,flake8,mypy,py3
+envlist = black,flake8,mypy,py3
[testenv]
extras =
@@ -11,6 +11,7 @@
{envsitepackagesdir}/swh/provenance \
--cov={envsitepackagesdir}/swh/provenance \
--cov-branch {posargs}
+passenv = HOME # required by pytest-rabbitmq
[testenv:black]
skip_install = true
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 20 2024, 6:00 AM (11 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3232199
Attached To
D6339: Add support for remote backend on existing storage tests
Event Timeline
Log In to Comment