Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.indexer.tests.test_cli::test_cli_journal_client_index[*]
Failed

TEST RESULT

Run At
Jul 20 2022, 7:31 PM
Details
cli_runner = <click.testing.CliRunner object at 0x7f7cf9173e80> swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_cli_journal_client_index_1/indexer.yml' kafka_prefix = 'tlghhuwfhw', kafka_server = '127.0.0.1:38153' consumer = <cimpl.Consumer object at 0x7f7cf93394a8> idx_storage = <swh.indexer.storage.IndexerStorage object at 0x7f7cf94031d0> storage = <swh.storage.postgresql.storage.Storage object at 0x7f7cf9403a90> mocker = <pytest_mock.plugin.MockerFixture object at 0x7f7cf9403278> swh_indexer_config = {'compute_checksums': ['blake2b512'], 'indexer_storage': {'cls': 'local', 'db': "user=postgres password=xxx dbname=tes...cheduler': {'cls': 'local', 'db': "user=postgres password=xxx dbname=tests host=127.0.0.1 port=15025 options=''"}, ...} indexer_name = '*' @pytest.mark.parametrize("indexer_name", ["origin-intrinsic-metadata", "*"]) def test_cli_journal_client_index( cli_runner, swh_config, kafka_prefix: str, kafka_server, consumer: Consumer, idx_storage, storage, mocker, swh_indexer_config, indexer_name: str, ): """Test the 'swh indexer journal-client' cli tool.""" journal_writer = get_journal_writer( "kafka", brokers=[kafka_server], prefix=kafka_prefix, client_id="test producer", value_sanitizer=lambda object_type, value: value, flush_timeout=3, # fail early if something is going wrong ) visit_statuses = [ OriginVisitStatus( origin="file:///dev/zero", visit=1, date=now(), status="full", snapshot=None, ), OriginVisitStatus( origin="file:///dev/foobar", visit=2, date=now(), status="full", snapshot=None, ), OriginVisitStatus( origin="file:///tmp/spamegg", visit=3, date=now(), status="full", snapshot=None, ), OriginVisitStatus( origin="file:///dev/0002", visit=6, date=now(), status="full", snapshot=None, ), OriginVisitStatus( # will be filtered out due to its 'partial' status origin="file:///dev/0000", visit=4, date=now(), status="partial", snapshot=None, ), OriginVisitStatus( # will be filtered out due to its 'ongoing' status origin="file:///dev/0001", visit=5, date=now(), status="ongoing", snapshot=None, ), ] journal_writer.write_additions("origin_visit_status", visit_statuses) visit_statuses_full = [vs for vs in visit_statuses if vs.status == "full"] storage.revision_add([REVISION]) mocker.patch( "swh.indexer.metadata.get_head_swhid", return_value=REVISION.swhid(), ) mocker.patch( "swh.indexer.metadata.DirectoryMetadataIndexer.index", return_value=[ DirectoryIntrinsicMetadataRow( id=DIRECTORY2.id, indexer_configuration_id=1, mappings=["cff"], metadata={"foo": "bar"}, ) ], ) result = cli_runner.invoke( indexer_cli_group, [ "-C", swh_config, "journal-client", indexer_name, "--broker", kafka_server, "--prefix", kafka_prefix, "--group-id", "test-consumer", "--stop-after-objects", len(visit_statuses), ], catch_exceptions=False, ) # Check the output expected_output = "Done.\n" assert result.exit_code == 0, result.output assert result.output == expected_output results = idx_storage.origin_intrinsic_metadata_get( [status.origin for status in visit_statuses] ) expected_results = [ OriginIntrinsicMetadataRow( id=status.origin, from_directory=DIRECTORY2.id, tool={"id": 1, **swh_indexer_config["tools"]}, mappings=["cff"], metadata={"foo": "bar"}, ) for status in sorted(visit_statuses_full, key=lambda r: r.origin) ] > assert sorted(results, key=lambda r: r.id) == expected_results E AssertionError: assert [] == [OriginIntrin...ings=['cff'])] E Right contains 4 more items, first extra item: OriginIntrinsicMetadataRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1',...0002', metadata={'foo': 'bar'}, from_directory=b'\xf8zz\xa1\x12`<1$\xfav\xf9\x01\xfd5\x85F`\xf2\xb6', mappings=['cff']) E Full diff: E [ E + , E - OriginIntrinsicMetadataRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1', 'configuration': {'type': 'library', 'debian-package': 'python3-magic'}}, id='file:///dev/0002', metadata={'foo': 'bar'}, from_directory=b'\xf8zz\xa1\x12`<1$\xfav\xf9\x01\xfd5\x8... E E ...Full output truncated (5 lines hidden), use '-vv' to show .tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:658: AssertionError