Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.indexer.tests.test_cli::test_cli_journal_client_index__content_mimetype
Failed

TEST RESULT

Run At
Jul 22 2022, 11:58 AM
Details
cli_runner = <click.testing.CliRunner object at 0x7feb3c145780> swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_cli_journal_client_index_4/indexer.yml' kafka_prefix = 'xcalxvfsen', kafka_server = '127.0.0.1:41093' consumer = <cimpl.Consumer object at 0x7feb3c183688> idx_storage = <swh.indexer.storage.IndexerStorage object at 0x7feb3c149e80> obj_storage = <swh.objstorage.backends.pathslicing.PathSlicingObjStorage object at 0x7feb3c149390> storage = <swh.storage.postgresql.storage.Storage object at 0x7feb3c105ac8> mocker = <pytest_mock.plugin.MockerFixture object at 0x7feb3c149ef0> 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=17664 options=''"}, ...} def test_cli_journal_client_index__content_mimetype( cli_runner, swh_config, kafka_prefix: str, kafka_server, consumer: Consumer, idx_storage, obj_storage, storage, mocker, swh_indexer_config, ): """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 ) contents = [] expected_results = [] content_ids = [] for content_id, content_d in RAW_CONTENTS.items(): raw_content = content_d[0] content = Content.from_data(raw_content) assert content_id == content.sha1 contents.append(content) content_ids.append(content_id) if isinstance(content_d[1], tuple): mimetype = content_d[1][1] else: mimetype = content_d[1] encoding = content_d[2] content_mimetype_row = ContentMimetypeRow( id=content.sha1, tool={"id": 1, **swh_indexer_config["tools"]}, mimetype=mimetype, encoding=encoding, ) expected_results.append(content_mimetype_row) assert len(contents) == len(RAW_CONTENTS) storage.content_add(contents) journal_writer.write_additions("content", contents) result = cli_runner.invoke( indexer_cli_group, [ "-C", swh_config, "journal-client", "content-mimetype", "--broker", kafka_server, "--prefix", kafka_prefix, "--group-id", "test-consumer", "--stop-after-objects", len(contents), ], 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.content_mimetype_get(content_ids) assert len(results) == len(expected_results) for result in results: > assert result in expected_results E AssertionError: assert ContentMimetypeRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1', 'configuration': {'type': 'library', 'debian-package': 'python3-magic'}}, id=b'\x0fu\xaeO}u\xd4.\x12\xc1\xb6W!\xec\xae^v\xfe\xe2#', mimetype='text/x-python', encoding='us-ascii') in [ContentMimetypeRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1', 'configuration': {'type': 'library', 'debian-package': 'python3-magic'}}, id=b'\x97\xbbi^ij\xda\xfay\xba\x82\x7f5\x90\x80\x91\xae\x9fa\x93', mimetype='text/plain', encoding='utf-8'), ContentMimetypeRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1', 'configuration': {'type': 'library', 'debian-package': 'python3-magic'}}, id=b'\x0fu\xaeO}u\xd4.\x12\xc1\xb6W!\xec\xae^v\xfe\xe2#', mimetype='text/x-script.python', encoding='us-ascii'), ContentMimetypeRow(indexer_configuration_id=None, tool={'id': 1, 'name': 'file', 'version': '1:5.30-1+deb9u1', 'configuration': {'type': 'library', 'debian-package': 'python3-magic'}}, id=b'\t\x1e4\x8a\xaa~#\xe4\xac\xe29j\xf3o\xd4\xe1\xda\xdbC\xd0', mimetype='application/octet-stream', encoding='')] .tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_cli.py:816: AssertionError