Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_replay::test_storage_replayer
Failed

TEST RESULT

Run At
Jun 12 2020, 3:31 PM
Details
replayer_storage_and_client = (<swh.storage.in_memory.InMemoryStorage object at 0x7f5fe585d710>, <swh.journal.client.JournalClient object at 0x7f5fe585df28>) caplog = <_pytest.logging.LogCaptureFixture object at 0x7f5fe57f6908> def test_storage_replayer(replayer_storage_and_client, caplog): """Optimal replayer scenario. This: - writes objects to a source storage - replayer consumes objects from the topic and replays them - a destination storage is filled from this In the end, both storages should have the same content. """ src, replayer = replayer_storage_and_client # Fill Kafka using a source storage nb_sent = 0 for object_type, objects in TEST_OBJECTS.items(): method = getattr(src, object_type + "_add") method(objects) if object_type == "origin_visit": nb_sent += len(objects) # origin-visit-add adds origin-visit-status as well nb_sent += len(objects) caplog.set_level(logging.ERROR, "swh.journal.replay") # Fill the destination storage from Kafka dst = get_storage(cls="memory") worker_fn = functools.partial(process_replay_objects, storage=dst) nb_inserted = replayer.process(worker_fn) assert nb_sent == nb_inserted > _check_replayed(src, dst) .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_replay.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src = <swh.storage.in_memory.InMemoryStorage object at 0x7f5fe585d710> dst = <swh.storage.in_memory.InMemoryStorage object at 0x7f5fe2e339e8> exclude = None def _check_replayed( src: InMemoryStorage, dst: InMemoryStorage, exclude: Optional[Container] = None ): """Simple utility function to compare the content of 2 in_memory storages """ expected_persons = set(src._persons.values()) got_persons = set(dst._persons.values()) assert got_persons == expected_persons for attr in ( "contents", "skipped_contents", "directories", "revisions", "releases", "snapshots", "origins", "origin_visits", "origin_visit_statuses", ): if exclude and attr in exclude: continue expected_objects = sorted(getattr(src, f"_{attr}").items()) got_objects = sorted(getattr(dst, f"_{attr}").items()) > assert got_objects == expected_objects, f"Mismatch object list for {attr}" E AssertionError: Mismatch object list for origin_visit_statuses E assert [(('https://o...z': 'qux'})])] == [(('https://o...z': 'qux'})])] E At index 0 diff: (('https://overtherainbow.org/fox/den', 1), [OriginVisitStatus(origin='https://overtherainbow.org/fox/den', visit=1, date=datetime.datetime(2014, 11, 27, 17, 20, 39, tzinfo=tzlocal()), status='ongoing', snapshot=None, metadata={'baz': 'qux'}), OriginVisitStatus(origin='https://overtherainbow.org/fox/den', visit=1, date=datetime.datetime(2014, 11, 27, 17, 20, 39, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00')), status='ongoing', snapshot=None, metadata={'baz': 'qux'}), OriginVisitStatus(origin='https://overtherainbow.org/fox/den', visit=1, dat... E E ...Full output truncated (59 lines hidden), use '-vv' to show .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_replay.py:210: AssertionError