swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7eff507436a0>
swh_storage_backend_config = {'check_config': {'check_write': True}, 'cls': 'postgresql', 'db': "user=postgres password=xxx dbname=tests host=127.0.0.1 port=22108 options=''", 'objstorage': {'cls': 'memory'}}
kafka_prefix = 'khhsyazvgo', kafka_server = '127.0.0.1:42141'
consumer = <cimpl.Consumer object at 0x7eff50cc59a8>
tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_cli_revision_from_journal0')
provenance = <swh.provenance.provenance.Provenance object at 0x7eff50862668>
provenance_postgresql = <connection object at 0x7eff50e78908; dsn: 'user=postgres password=xxx dbname=provenance_tests host=127.0.0.1 port=29817 options=''', closed: 0>
def test_cli_revision_from_journal_client(
swh_storage: StorageInterface,
swh_storage_backend_config: Dict,
kafka_prefix: str,
kafka_server: str,
consumer: Consumer,
tmp_path: str,
provenance,
provenance_postgresql,
) -> None:
"""Test revision journal client cli"""
# Prepare storage data
data = load_repo_data("cmdbts2")
assert len(data["origin"]) == 1
fill_storage(swh_storage, data)
# Prepare configuration for cli call
swh_storage_backend_config.pop("journal_writer", None) # no need for that config
storage_config_dict = swh_storage_backend_config
cfg = {
"journal_client": {
"cls": "kafka",
"brokers": [kafka_server],
"group_id": "toto",
"prefix": kafka_prefix,
"object_types": ["revision"],
"stop_on_eof": True,
},
"provenance": {
"archive": {
"cls": "api",
"storage": storage_config_dict,
},
"storage": {
"cls": "postgresql",
"db": provenance_postgresql.get_dsn_parameters(),
},
},
}
config_path = write_configuration_path(cfg, tmp_path)
# call the cli 'swh provenance revision from-journal'
result = invoke(["revision", "from-journal"], config_path)
assert result.exit_code == 0, f"Unexpected result: {result.output}"
breakpoint()
> revisions = [rev["id"] for rev in data["revision"]]
.tox/py3/lib/python3.7/site-packages/swh/provenance/tests/test_journal_client.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/provenance/tests/test_journal_client.py:132: in test_cli_revision_from_journal_client
revisions = [rev["id"] for rev in data["revision"]]
/usr/lib/python3.7/bdb.py:88: in trace_dispatch
return self.dispatch_line(frame)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.debugging.pytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper object at 0x7eff508c2eb8>
frame = <frame at 0x1d71328, file '/var/lib/jenkins/workspace/DPROV/tests-on-diff@3/.tox/py3/lib/python3.7/site-packages/swh/provenance/tests/test_journal_client.py', line 132, code test_cli_revision_from_journal_client>
def dispatch_line(self, frame):
"""Invoke user function and return trace function for line event.
If the debugger stops on the current line, invoke
self.user_line(). Raise BdbQuit if self.quitting is set.
Return self.trace_dispatch to continue tracing in this scope.
"""
if self.stop_here(frame) or self.break_here(frame):
self.user_line(frame)
> if self.quitting: raise BdbQuit
E bdb.BdbQuit
/usr/lib/python3.7/bdb.py:113: BdbQuit
TEST RESULT
TEST RESULT
- Run At
- Jul 8 2022, 2:42 PM