From 05427f0f0bec6c060c58ee6ed1deaa3aff3f96c0 Mon Sep 17 00:00:00 2001 From: Emmanuel Evbuomwan Date: Fri, 24 Jan 2025 17:25:44 +0100 Subject: [PATCH] module: move `src/karapace/core/backup` to `src/karapace/backup` - the `schema_tool` runs against avro schemas at a specific path --- GNUmakefile | 2 +- pyproject.toml | 2 +- src/karapace/{core => }/backup/__init__.py | 0 src/karapace/{core => }/backup/api.py | 6 ++--- .../{core => }/backup/backends/__init__.py | 0 .../{core => }/backup/backends/reader.py | 0 src/karapace/{core => }/backup/backends/v1.py | 2 +- src/karapace/{core => }/backup/backends/v2.py | 4 ++-- .../{core => }/backup/backends/v3/__init__.py | 0 .../backup/backends/v3/avro/DataFile.avsc | 0 .../backup/backends/v3/avro/Header.avsc | 0 .../backup/backends/v3/avro/Metadata.avsc | 0 .../backup/backends/v3/avro/Record.avsc | 0 .../{core => }/backup/backends/v3/backend.py | 6 ++--- .../{core => }/backup/backends/v3/checksum.py | 0 .../backup/backends/v3/constants.py | 0 .../{core => }/backup/backends/v3/errors.py | 2 +- .../{core => }/backup/backends/v3/readers.py | 0 .../{core => }/backup/backends/v3/schema.py | 0 .../backup/backends/v3/schema_tool.py | 0 .../{core => }/backup/backends/v3/writers.py | 0 .../{core => }/backup/backends/writer.py | 2 +- src/karapace/{core => }/backup/cli.py | 2 +- src/karapace/{core => }/backup/encoders.py | 0 src/karapace/{core => }/backup/errors.py | 2 +- .../{core => }/backup/poll_timeout.py | 0 src/karapace/{core => }/backup/safe_writer.py | 0 .../{core => }/backup/topic_configurations.py | 0 tests/integration/backup/test_avro_export.py | 4 ++-- .../backup/test_get_topic_configurations.py | 2 +- .../integration/backup/test_legacy_backup.py | 8 +++---- .../backup/test_session_timeout.py | 2 +- tests/integration/backup/test_v3_backup.py | 24 +++++++++---------- tests/unit/backup/backends/test_v1.py | 6 ++--- tests/unit/backup/backends/test_v2.py | 6 ++--- tests/unit/backup/backends/v3/test_backend.py | 10 ++++---- .../backup/backends/v3/test_serialisation.py | 8 +++---- tests/unit/backup/test_api.py | 10 ++++---- tests/unit/backup/test_encoders.py | 2 +- tests/unit/backup/test_poll_timeout.py | 2 +- tests/unit/backup/test_safe_writer.py | 2 +- 41 files changed, 58 insertions(+), 58 deletions(-) rename src/karapace/{core => }/backup/__init__.py (100%) rename src/karapace/{core => }/backup/api.py (98%) rename src/karapace/{core => }/backup/backends/__init__.py (100%) rename src/karapace/{core => }/backup/backends/reader.py (100%) rename src/karapace/{core => }/backup/backends/v1.py (87%) rename src/karapace/{core => }/backup/backends/v2.py (95%) rename src/karapace/{core => }/backup/backends/v3/__init__.py (100%) rename src/karapace/{core => }/backup/backends/v3/avro/DataFile.avsc (100%) rename src/karapace/{core => }/backup/backends/v3/avro/Header.avsc (100%) rename src/karapace/{core => }/backup/backends/v3/avro/Metadata.avsc (100%) rename src/karapace/{core => }/backup/backends/v3/avro/Record.avsc (100%) rename src/karapace/{core => }/backup/backends/v3/backend.py (98%) rename src/karapace/{core => }/backup/backends/v3/checksum.py (100%) rename src/karapace/{core => }/backup/backends/v3/constants.py (100%) rename src/karapace/{core => }/backup/backends/v3/errors.py (94%) rename src/karapace/{core => }/backup/backends/v3/readers.py (100%) rename src/karapace/{core => }/backup/backends/v3/schema.py (100%) rename src/karapace/{core => }/backup/backends/v3/schema_tool.py (100%) rename src/karapace/{core => }/backup/backends/v3/writers.py (100%) rename src/karapace/{core => }/backup/backends/writer.py (98%) rename src/karapace/{core => }/backup/cli.py (99%) rename src/karapace/{core => }/backup/encoders.py (100%) rename src/karapace/{core => }/backup/errors.py (97%) rename src/karapace/{core => }/backup/poll_timeout.py (100%) rename src/karapace/{core => }/backup/safe_writer.py (100%) rename src/karapace/{core => }/backup/topic_configurations.py (100%) diff --git a/GNUmakefile b/GNUmakefile index 6aaa184a0..66ff6077e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -99,7 +99,7 @@ requirements: .PHONY: schema schema: against := origin/main schema: - $(PYTHON) -m karapace.core.backup.backends.v3.schema_tool --against=$(against) + $(PYTHON) -m karapace.backup.backends.v3.schema_tool --against=$(against) .PHONY: pin-requirements pin-requirements: diff --git a/pyproject.toml b/pyproject.toml index 92bc0b541..aee3ddb94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ classifiers=[ [project.scripts] karapace = "karapace.core.karapace_all:main" -karapace_schema_backup = "karapace.core.backup.cli:main" +karapace_schema_backup = "karapace.backup.cli:main" karapace_mkpasswd = "karapace.core.auth:main" [project.urls] diff --git a/src/karapace/core/backup/__init__.py b/src/karapace/backup/__init__.py similarity index 100% rename from src/karapace/core/backup/__init__.py rename to src/karapace/backup/__init__.py diff --git a/src/karapace/core/backup/api.py b/src/karapace/backup/api.py similarity index 98% rename from src/karapace/core/backup/api.py rename to src/karapace/backup/api.py index 41bca4ec5..b2fb32c6d 100644 --- a/src/karapace/core/backup/api.py +++ b/src/karapace/backup/api.py @@ -29,9 +29,9 @@ from enum import Enum from functools import partial from karapace.core import constants -from karapace.core.backup.backends.v1 import SchemaBackupV1Reader -from karapace.core.backup.backends.v2 import AnonymizeAvroWriter, SchemaBackupV2Reader, SchemaBackupV2Writer, V2_MARKER -from karapace.core.backup.backends.v3.backend import SchemaBackupV3Reader, SchemaBackupV3Writer, VerifyFailure, VerifySuccess +from karapace.backup.backends.v1 import SchemaBackupV1Reader +from karapace.backup.backends.v2 import AnonymizeAvroWriter, SchemaBackupV2Reader, SchemaBackupV2Writer, V2_MARKER +from karapace.backup.backends.v3.backend import SchemaBackupV3Reader, SchemaBackupV3Writer, VerifyFailure, VerifySuccess from karapace.core.config import Config from karapace.core.kafka.admin import KafkaAdminClient from karapace.core.kafka.common import translate_from_kafkaerror diff --git a/src/karapace/core/backup/backends/__init__.py b/src/karapace/backup/backends/__init__.py similarity index 100% rename from src/karapace/core/backup/backends/__init__.py rename to src/karapace/backup/backends/__init__.py diff --git a/src/karapace/core/backup/backends/reader.py b/src/karapace/backup/backends/reader.py similarity index 100% rename from src/karapace/core/backup/backends/reader.py rename to src/karapace/backup/backends/reader.py diff --git a/src/karapace/core/backup/backends/v1.py b/src/karapace/backup/backends/v1.py similarity index 87% rename from src/karapace/core/backup/backends/v1.py rename to src/karapace/backup/backends/v1.py index ebee67fe6..b6970f988 100644 --- a/src/karapace/core/backup/backends/v1.py +++ b/src/karapace/backup/backends/v1.py @@ -6,7 +6,7 @@ from __future__ import annotations from collections.abc import Generator -from karapace.core.backup.backends.reader import BaseItemsBackupReader +from karapace.backup.backends.reader import BaseItemsBackupReader from karapace.core.utils import json_decode from typing import IO diff --git a/src/karapace/core/backup/backends/v2.py b/src/karapace/backup/backends/v2.py similarity index 95% rename from src/karapace/core/backup/backends/v2.py rename to src/karapace/backup/backends/v2.py index 4c1c72bbf..ce47b864b 100644 --- a/src/karapace/core/backup/backends/v2.py +++ b/src/karapace/backup/backends/v2.py @@ -7,8 +7,8 @@ from collections.abc import Generator, Sequence from karapace.core.anonymize_schemas import anonymize_avro -from karapace.core.backup.backends.reader import BaseItemsBackupReader -from karapace.core.backup.backends.writer import BaseKVBackupWriter, StdOut +from karapace.backup.backends.reader import BaseItemsBackupReader +from karapace.backup.backends.writer import BaseKVBackupWriter, StdOut from karapace.core.utils import json_decode, json_encode from pathlib import Path from typing import Any, ClassVar, Final, IO diff --git a/src/karapace/core/backup/backends/v3/__init__.py b/src/karapace/backup/backends/v3/__init__.py similarity index 100% rename from src/karapace/core/backup/backends/v3/__init__.py rename to src/karapace/backup/backends/v3/__init__.py diff --git a/src/karapace/core/backup/backends/v3/avro/DataFile.avsc b/src/karapace/backup/backends/v3/avro/DataFile.avsc similarity index 100% rename from src/karapace/core/backup/backends/v3/avro/DataFile.avsc rename to src/karapace/backup/backends/v3/avro/DataFile.avsc diff --git a/src/karapace/core/backup/backends/v3/avro/Header.avsc b/src/karapace/backup/backends/v3/avro/Header.avsc similarity index 100% rename from src/karapace/core/backup/backends/v3/avro/Header.avsc rename to src/karapace/backup/backends/v3/avro/Header.avsc diff --git a/src/karapace/core/backup/backends/v3/avro/Metadata.avsc b/src/karapace/backup/backends/v3/avro/Metadata.avsc similarity index 100% rename from src/karapace/core/backup/backends/v3/avro/Metadata.avsc rename to src/karapace/backup/backends/v3/avro/Metadata.avsc diff --git a/src/karapace/core/backup/backends/v3/avro/Record.avsc b/src/karapace/backup/backends/v3/avro/Record.avsc similarity index 100% rename from src/karapace/core/backup/backends/v3/avro/Record.avsc rename to src/karapace/backup/backends/v3/avro/Record.avsc diff --git a/src/karapace/core/backup/backends/v3/backend.py b/src/karapace/backup/backends/v3/backend.py similarity index 98% rename from src/karapace/core/backup/backends/v3/backend.py rename to src/karapace/backup/backends/v3/backend.py index 78fbf7076..0ddc74d48 100644 --- a/src/karapace/core/backup/backends/v3/backend.py +++ b/src/karapace/backup/backends/v3/backend.py @@ -13,9 +13,9 @@ from collections.abc import Callable, Generator, Iterator, Mapping, Sequence from confluent_kafka import Message from dataclasses import dataclass -from karapace.core.backup.backends.reader import BaseBackupReader, Instruction, ProducerSend, RestoreTopic -from karapace.core.backup.backends.writer import BytesBackupWriter, StdOut -from karapace.core.backup.safe_writer import bytes_writer, staging_directory +from karapace.backup.backends.reader import BaseBackupReader, Instruction, ProducerSend, RestoreTopic +from karapace.backup.backends.writer import BytesBackupWriter, StdOut +from karapace.backup.safe_writer import bytes_writer, staging_directory from karapace.core.dataclasses import default_dataclass from karapace.core.utils import assert_never from karapace.version import __version__ diff --git a/src/karapace/core/backup/backends/v3/checksum.py b/src/karapace/backup/backends/v3/checksum.py similarity index 100% rename from src/karapace/core/backup/backends/v3/checksum.py rename to src/karapace/backup/backends/v3/checksum.py diff --git a/src/karapace/core/backup/backends/v3/constants.py b/src/karapace/backup/backends/v3/constants.py similarity index 100% rename from src/karapace/core/backup/backends/v3/constants.py rename to src/karapace/backup/backends/v3/constants.py diff --git a/src/karapace/core/backup/backends/v3/errors.py b/src/karapace/backup/backends/v3/errors.py similarity index 94% rename from src/karapace/core/backup/backends/v3/errors.py rename to src/karapace/backup/backends/v3/errors.py index 9a16df8c8..9324fa84f 100644 --- a/src/karapace/core/backup/backends/v3/errors.py +++ b/src/karapace/backup/backends/v3/errors.py @@ -3,7 +3,7 @@ See LICENSE for details """ -from karapace.core.backup.errors import BackupError +from karapace.backup.errors import BackupError class DecodeError(BackupError): diff --git a/src/karapace/core/backup/backends/v3/readers.py b/src/karapace/backup/backends/v3/readers.py similarity index 100% rename from src/karapace/core/backup/backends/v3/readers.py rename to src/karapace/backup/backends/v3/readers.py diff --git a/src/karapace/core/backup/backends/v3/schema.py b/src/karapace/backup/backends/v3/schema.py similarity index 100% rename from src/karapace/core/backup/backends/v3/schema.py rename to src/karapace/backup/backends/v3/schema.py diff --git a/src/karapace/core/backup/backends/v3/schema_tool.py b/src/karapace/backup/backends/v3/schema_tool.py similarity index 100% rename from src/karapace/core/backup/backends/v3/schema_tool.py rename to src/karapace/backup/backends/v3/schema_tool.py diff --git a/src/karapace/core/backup/backends/v3/writers.py b/src/karapace/backup/backends/v3/writers.py similarity index 100% rename from src/karapace/core/backup/backends/v3/writers.py rename to src/karapace/backup/backends/v3/writers.py diff --git a/src/karapace/core/backup/backends/writer.py b/src/karapace/backup/backends/writer.py similarity index 98% rename from src/karapace/core/backup/backends/writer.py rename to src/karapace/backup/backends/writer.py index ddc876d38..281b20c89 100644 --- a/src/karapace/core/backup/backends/writer.py +++ b/src/karapace/backup/backends/writer.py @@ -7,7 +7,7 @@ from collections.abc import Iterator, Mapping, Sequence from confluent_kafka import Message -from karapace.core.backup.safe_writer import bytes_writer, str_writer +from karapace.backup.safe_writer import bytes_writer, str_writer from pathlib import Path from typing import ContextManager, Generic, IO, Literal, TypeAlias, TypeVar diff --git a/src/karapace/core/backup/cli.py b/src/karapace/backup/cli.py similarity index 99% rename from src/karapace/core/backup/cli.py rename to src/karapace/backup/cli.py index dba8bfc64..191797ca2 100644 --- a/src/karapace/core/backup/cli.py +++ b/src/karapace/backup/cli.py @@ -12,7 +12,7 @@ from .poll_timeout import PollTimeout from aiokafka.errors import BrokerResponseError from collections.abc import Iterator -from karapace.core.backup.api import VerifyLevel +from karapace.backup.api import VerifyLevel from karapace.core.config import Config from pydantic_settings import BaseSettings, JsonConfigSettingsSource, PydanticBaseSettingsSource from typing import Type diff --git a/src/karapace/core/backup/encoders.py b/src/karapace/backup/encoders.py similarity index 100% rename from src/karapace/core/backup/encoders.py rename to src/karapace/backup/encoders.py diff --git a/src/karapace/core/backup/errors.py b/src/karapace/backup/errors.py similarity index 97% rename from src/karapace/core/backup/errors.py rename to src/karapace/backup/errors.py index 4fa0e7103..10f9e2c72 100644 --- a/src/karapace/core/backup/errors.py +++ b/src/karapace/backup/errors.py @@ -4,7 +4,7 @@ """ from confluent_kafka import TopicPartition -from karapace.core.backup.poll_timeout import PollTimeout +from karapace.backup.poll_timeout import PollTimeout __all__ = ["BackupError", "BackupTopicAlreadyExists", "EmptyPartition", "PartitionCountError", "StaleConsumerError"] diff --git a/src/karapace/core/backup/poll_timeout.py b/src/karapace/backup/poll_timeout.py similarity index 100% rename from src/karapace/core/backup/poll_timeout.py rename to src/karapace/backup/poll_timeout.py diff --git a/src/karapace/core/backup/safe_writer.py b/src/karapace/backup/safe_writer.py similarity index 100% rename from src/karapace/core/backup/safe_writer.py rename to src/karapace/backup/safe_writer.py diff --git a/src/karapace/core/backup/topic_configurations.py b/src/karapace/backup/topic_configurations.py similarity index 100% rename from src/karapace/core/backup/topic_configurations.py rename to src/karapace/backup/topic_configurations.py diff --git a/tests/integration/backup/test_avro_export.py b/tests/integration/backup/test_avro_export.py index 748577bf5..828cf3e09 100644 --- a/tests/integration/backup/test_avro_export.py +++ b/tests/integration/backup/test_avro_export.py @@ -5,8 +5,8 @@ See LICENSE for details """ -from karapace.core.backup import api -from karapace.core.backup.api import BackupVersion +from karapace.backup import api +from karapace.backup.api import BackupVersion from karapace.core.client import Client from karapace.core.config import Config from karapace.core.utils import json_encode diff --git a/tests/integration/backup/test_get_topic_configurations.py b/tests/integration/backup/test_get_topic_configurations.py index 84c4b3bd2..c80ddfe60 100644 --- a/tests/integration/backup/test_get_topic_configurations.py +++ b/tests/integration/backup/test_get_topic_configurations.py @@ -6,7 +6,7 @@ from __future__ import annotations from confluent_kafka.admin import NewTopic -from karapace.core.backup.topic_configurations import ( +from karapace.backup.topic_configurations import ( ALL_CONFIG_SOURCES, ConfigSource, DEFAULT_CONFIGS, diff --git a/tests/integration/backup/test_legacy_backup.py b/tests/integration/backup/test_legacy_backup.py index ca5ba0348..32b44c5e3 100644 --- a/tests/integration/backup/test_legacy_backup.py +++ b/tests/integration/backup/test_legacy_backup.py @@ -6,10 +6,10 @@ """ from aiokafka.errors import InvalidTopicError -from karapace.core.backup import api -from karapace.core.backup.api import BackupVersion -from karapace.core.backup.errors import StaleConsumerError -from karapace.core.backup.poll_timeout import PollTimeout +from karapace.backup import api +from karapace.backup.api import BackupVersion +from karapace.backup.errors import StaleConsumerError +from karapace.backup.poll_timeout import PollTimeout from karapace.core.client import Client from karapace.core.config import Config from karapace.core.kafka.admin import KafkaAdminClient diff --git a/tests/integration/backup/test_session_timeout.py b/tests/integration/backup/test_session_timeout.py index e876e7010..3a8f20145 100644 --- a/tests/integration/backup/test_session_timeout.py +++ b/tests/integration/backup/test_session_timeout.py @@ -5,7 +5,7 @@ from aiokafka.errors import NoBrokersAvailable from confluent_kafka.admin import NewTopic -from karapace.core.backup.api import BackupVersion, create_backup +from karapace.backup.api import BackupVersion, create_backup from karapace.core.config import Config from karapace.core.kafka.admin import KafkaAdminClient from karapace.core.kafka_utils import kafka_producer_from_config diff --git a/tests/integration/backup/test_v3_backup.py b/tests/integration/backup/test_v3_backup.py index d6080cd97..7bfa51fce 100644 --- a/tests/integration/backup/test_v3_backup.py +++ b/tests/integration/backup/test_v3_backup.py @@ -10,14 +10,14 @@ from confluent_kafka import Message, TopicPartition from confluent_kafka.admin import NewTopic from dataclasses import fields -from karapace.core.backup import api -from karapace.core.backup.api import _consume_records, BackupVersion, TopicName -from karapace.core.backup.backends.v3.errors import InconsistentOffset -from karapace.core.backup.backends.v3.readers import read_metadata -from karapace.core.backup.backends.v3.schema import Metadata -from karapace.core.backup.errors import BackupDataRestorationError, EmptyPartition -from karapace.core.backup.poll_timeout import PollTimeout -from karapace.core.backup.topic_configurations import ConfigSource, get_topic_configurations +from karapace.backup import api +from karapace.backup.api import _consume_records, BackupVersion, TopicName +from karapace.backup.backends.v3.errors import InconsistentOffset +from karapace.backup.backends.v3.readers import read_metadata +from karapace.backup.backends.v3.schema import Metadata +from karapace.backup.errors import BackupDataRestorationError, EmptyPartition +from karapace.backup.poll_timeout import PollTimeout +from karapace.backup.topic_configurations import ConfigSource, get_topic_configurations from karapace.core.config import Config from karapace.core.kafka.admin import KafkaAdminClient from karapace.core.kafka.consumer import KafkaConsumer @@ -573,7 +573,7 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): self._producer.flush() - with patch("karapace.core.backup.api._producer") as p: + with patch("karapace.backup.api._producer") as p: p.return_value = LowTimeoutProducer() with pytest.raises(BackupDataRestorationError) as excinfo: api.restore_backup( @@ -622,7 +622,7 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): self._producer.flush() - with patch("karapace.core.backup.api._producer") as p: + with patch("karapace.backup.api._producer") as p: p.return_value = FailToSendProducerContext() with pytest.raises(BackupDataRestorationError): api.restore_backup( @@ -672,7 +672,7 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): self._producer.flush() - with patch("karapace.core.backup.api._producer") as p: + with patch("karapace.backup.api._producer") as p: p.return_value = FailToSendProducerContext() with pytest.raises(BackupDataRestorationError, match="Kafka producer buffer is full"): api.restore_backup( @@ -1202,7 +1202,7 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): self._consumer.close() - with patch("karapace.core.backup.api._consumer") as consumer_patch: + with patch("karapace.backup.api._consumer") as consumer_patch: consumer_patch.return_value = ConsumerContext() try: api.create_backup( diff --git a/tests/unit/backup/backends/test_v1.py b/tests/unit/backup/backends/test_v1.py index 504aa9e36..5101298c2 100644 --- a/tests/unit/backup/backends/test_v1.py +++ b/tests/unit/backup/backends/test_v1.py @@ -4,9 +4,9 @@ """ from functools import partial -from karapace.core.backup.backends.reader import ProducerSend, RestoreTopicLegacy -from karapace.core.backup.backends.v1 import SchemaBackupV1Reader -from karapace.core.backup.encoders import encode_key, encode_value +from karapace.backup.backends.reader import ProducerSend, RestoreTopicLegacy +from karapace.backup.backends.v1 import SchemaBackupV1Reader +from karapace.backup.encoders import encode_key, encode_value from karapace.core.key_format import KeyFormatter from pathlib import Path diff --git a/tests/unit/backup/backends/test_v2.py b/tests/unit/backup/backends/test_v2.py index 8282d3edb..de8a92be7 100644 --- a/tests/unit/backup/backends/test_v2.py +++ b/tests/unit/backup/backends/test_v2.py @@ -6,9 +6,9 @@ from __future__ import annotations from functools import partial -from karapace.core.backup.backends.reader import ProducerSend, RestoreTopicLegacy -from karapace.core.backup.backends.v2 import AnonymizeAvroWriter, SchemaBackupV2Reader, SchemaBackupV2Writer -from karapace.core.backup.encoders import encode_key, encode_value +from karapace.backup.backends.reader import ProducerSend, RestoreTopicLegacy +from karapace.backup.backends.v2 import AnonymizeAvroWriter, SchemaBackupV2Reader, SchemaBackupV2Writer +from karapace.backup.encoders import encode_key, encode_value from karapace.core.kafka.types import Timestamp from karapace.core.key_format import KeyFormatter from pathlib import Path diff --git a/tests/unit/backup/backends/v3/test_backend.py b/tests/unit/backup/backends/v3/test_backend.py index 43ae28b8c..518cb09ed 100644 --- a/tests/unit/backup/backends/v3/test_backend.py +++ b/tests/unit/backup/backends/v3/test_backend.py @@ -4,9 +4,9 @@ """ from dataclasses import replace -from karapace.core.backup.backends.reader import ProducerSend, RestoreTopic -from karapace.core.backup.backends.v3.backend import _PartitionStats, SchemaBackupV3Reader, SchemaBackupV3Writer -from karapace.core.backup.backends.v3.errors import ( +from karapace.backup.backends.reader import ProducerSend, RestoreTopic +from karapace.backup.backends.v3.backend import _PartitionStats, SchemaBackupV3Reader, SchemaBackupV3Writer +from karapace.backup.backends.v3.errors import ( InconsistentOffset, InvalidChecksum, OffsetMismatch, @@ -14,8 +14,8 @@ TooManyRecords, UnknownChecksumAlgorithm, ) -from karapace.core.backup.backends.v3.readers import read_records -from karapace.core.backup.backends.v3.schema import ChecksumAlgorithm, DataFile +from karapace.backup.backends.v3.readers import read_records +from karapace.backup.backends.v3.schema import ChecksumAlgorithm, DataFile from karapace.core.kafka.types import Timestamp from pathlib import Path from tests.utils import StubMessage diff --git a/tests/unit/backup/backends/v3/test_serialisation.py b/tests/unit/backup/backends/v3/test_serialisation.py index 5c5b17f18..9bddee6b1 100644 --- a/tests/unit/backup/backends/v3/test_serialisation.py +++ b/tests/unit/backup/backends/v3/test_serialisation.py @@ -5,7 +5,7 @@ from hypothesis import given from hypothesis.strategies import integers -from karapace.core.backup.backends.v3.errors import ( +from karapace.backup.backends.v3.errors import ( IntegerAboveBound, IntegerBelowBound, InvalidChecksum, @@ -13,9 +13,9 @@ TooFewRecords, TooManyRecords, ) -from karapace.core.backup.backends.v3.readers import read_metadata, read_record, read_records, read_uint32, read_uint64 -from karapace.core.backup.backends.v3.schema import DataFile, Header, Metadata, Record -from karapace.core.backup.backends.v3.writers import ( +from karapace.backup.backends.v3.readers import read_metadata, read_record, read_records, read_uint32, read_uint64 +from karapace.backup.backends.v3.schema import DataFile, Header, Metadata, Record +from karapace.backup.backends.v3.writers import ( UINT32_RANGE, UINT64_RANGE, write_metadata, diff --git a/tests/unit/backup/test_api.py b/tests/unit/backup/test_api.py index 256542a96..76198cb7e 100644 --- a/tests/unit/backup/test_api.py +++ b/tests/unit/backup/test_api.py @@ -7,7 +7,7 @@ from aiokafka.errors import KafkaError, TopicAlreadyExistsError from collections.abc import Callable -from karapace.core.backup.api import ( +from karapace.backup.api import ( _admin, _consumer, _handle_restore_topic, @@ -18,9 +18,9 @@ normalize_location, normalize_topic_name, ) -from karapace.core.backup.backends.reader import RestoreTopic, RestoreTopicLegacy -from karapace.core.backup.backends.writer import StdOut -from karapace.core.backup.errors import BackupError, PartitionCountError +from karapace.backup.backends.reader import RestoreTopic, RestoreTopicLegacy +from karapace.backup.backends.writer import StdOut +from karapace.backup.errors import BackupError, PartitionCountError from karapace.core.config import Config from karapace.core.constants import DEFAULT_SCHEMA_TOPIC from karapace.core.container import KarapaceContainer @@ -35,7 +35,7 @@ import pytest patch_admin_new = mock.patch( - "karapace.core.backup.api.KafkaAdminClient.__new__", + "karapace.backup.api.KafkaAdminClient.__new__", autospec=True, ) diff --git a/tests/unit/backup/test_encoders.py b/tests/unit/backup/test_encoders.py index ef6cb7ad6..edcb1b3c9 100644 --- a/tests/unit/backup/test_encoders.py +++ b/tests/unit/backup/test_encoders.py @@ -5,7 +5,7 @@ from __future__ import annotations -from karapace.core.backup.encoders import encode_key, encode_value +from karapace.backup.encoders import encode_key, encode_value from karapace.core.key_format import KeyFormatter from unittest import mock diff --git a/tests/unit/backup/test_poll_timeout.py b/tests/unit/backup/test_poll_timeout.py index 116262a01..3ce63d009 100644 --- a/tests/unit/backup/test_poll_timeout.py +++ b/tests/unit/backup/test_poll_timeout.py @@ -4,7 +4,7 @@ """ from datetime import timedelta -from karapace.core.backup.poll_timeout import PollTimeout +from karapace.backup.poll_timeout import PollTimeout import pytest diff --git a/tests/unit/backup/test_safe_writer.py b/tests/unit/backup/test_safe_writer.py index 86ac7834c..3e4e29203 100644 --- a/tests/unit/backup/test_safe_writer.py +++ b/tests/unit/backup/test_safe_writer.py @@ -3,7 +3,7 @@ See LICENSE for details """ -from karapace.core.backup.safe_writer import ( +from karapace.backup.safe_writer import ( _check_destination_file, bytes_writer, OverwriteRefused,