Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_replay.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import dataclasses | import dataclasses | ||||
import datetime | import datetime | ||||
import functools | import functools | ||||
import logging | import logging | ||||
from typing import Any, Container, Dict, Optional | from typing import Any, Container, Dict, Optional | ||||
import attr | import attr | ||||
import pytest | import pytest | ||||
from swh.journal.client import JournalClient | from swh.journal.client import JournalClient | ||||
from swh.journal.serializers import key_to_kafka, value_to_kafka | from swh.journal.serializers import key_to_kafka, value_to_kafka | ||||
from swh.journal.tests.journal_data import DUPLICATE_CONTENTS, TEST_OBJECTS | |||||
from swh.model.hashutil import DEFAULT_ALGORITHMS, MultiHash, hash_to_hex | from swh.model.hashutil import DEFAULT_ALGORITHMS, MultiHash, hash_to_hex | ||||
from swh.model.tests.swh_model_data import DUPLICATE_CONTENTS, TEST_OBJECTS | |||||
from swh.storage import get_storage | from swh.storage import get_storage | ||||
from swh.storage.cassandra.model import ContentRow, SkippedContentRow | from swh.storage.cassandra.model import ContentRow, SkippedContentRow | ||||
from swh.storage.in_memory import InMemoryStorage | from swh.storage.in_memory import InMemoryStorage | ||||
from swh.storage.replay import process_replay_objects | from swh.storage.replay import process_replay_objects | ||||
UTC = datetime.timezone.utc | UTC = datetime.timezone.utc | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | |||||
): | ): | ||||
"""Simple utility function to compare the content of 2 in_memory storages | """Simple utility function to compare the content of 2 in_memory storages | ||||
""" | """ | ||||
for attr_ in ( | for attr_ in ( | ||||
"contents", | "contents", | ||||
"skipped_contents", | "skipped_contents", | ||||
"directories", | "directories", | ||||
"extid", | |||||
"revisions", | "revisions", | ||||
"releases", | "releases", | ||||
"snapshots", | "snapshots", | ||||
"origins", | "origins", | ||||
"origin_visits", | "origin_visits", | ||||
"origin_visit_statuses", | "origin_visit_statuses", | ||||
"raw_extrinsic_metadata", | "raw_extrinsic_metadata", | ||||
): | ): | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |