Skip to content

Commit

Permalink
api: strip off core components
Browse files Browse the repository at this point in the history
  • Loading branch information
nosahama committed Jan 24, 2025
1 parent 69d4c87 commit 4675e6a
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/karapace/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dependency_injector import containers, providers
from karapace.core.container import KarapaceContainer
from karapace.api.controller import KarapaceSchemaRegistryController
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.telemetry.container import TelemetryContainer


Expand Down
2 changes: 1 addition & 1 deletion src/karapace/api/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from karapace.core.statsd import StatsClient
from karapace.core.typing import JsonData, JsonObject, SchemaId, Subject, Version
from karapace.core.utils import JSONDecodeError
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.routers.errors import no_primary_url_error, SchemaErrorCodes, SchemaErrorMessages
from karapace.api.routers.requests import (
CompatibilityCheckResponse,
Expand Down
4 changes: 2 additions & 2 deletions src/karapace/api/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from contextlib import asynccontextmanager
from dependency_injector.wiring import inject, Provide
from fastapi import Depends, FastAPI
from karapace.core import version as karapace_version
from karapace import version as karapace_version
from karapace.core.auth import AuthenticatorAndAuthorizer
from karapace.core.config import Config
from karapace.core.forward_client import ForwardClient
Expand All @@ -16,7 +16,7 @@
from karapace.api.container import SchemaRegistryContainer
from karapace.api.http_handlers import setup_exception_handlers
from karapace.api.middlewares import setup_middlewares
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.routers.setup import setup_routers
from karapace.api.telemetry.setup import setup_metering, setup_tracing
from typing import AsyncContextManager
Expand Down
2 changes: 1 addition & 1 deletion src/karapace/api/routers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from karapace.core.typing import Subject
from karapace.api.container import SchemaRegistryContainer
from karapace.api.controller import KarapaceSchemaRegistryController
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.routers.errors import no_primary_url_error, unauthorized
from karapace.api.routers.raw_path_router import RawPathRoute
from karapace.api.routers.requests import CompatibilityLevelResponse, CompatibilityRequest, CompatibilityResponse
Expand Down
2 changes: 1 addition & 1 deletion src/karapace/api/routers/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from opentelemetry.trace.status import StatusCode
from pydantic import BaseModel
from karapace.api.container import SchemaRegistryContainer
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.telemetry.tracer import Tracer


Expand Down
2 changes: 1 addition & 1 deletion src/karapace/api/routers/master_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from karapace.core.forward_client import ForwardClient
from pydantic import BaseModel
from karapace.api.container import SchemaRegistryContainer
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from typing import Final

import logging
Expand Down
2 changes: 1 addition & 1 deletion src/karapace/api/routers/subjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from karapace.core.typing import Subject
from karapace.api.container import SchemaRegistryContainer
from karapace.api.controller import KarapaceSchemaRegistryController
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.routers.errors import no_primary_url_error, unauthorized
from karapace.api.routers.raw_path_router import RawPathRoute
from karapace.api.routers.requests import SchemaIdResponse, SchemaRequest, SchemaResponse, SubjectSchemaVersionResponse
Expand Down
2 changes: 1 addition & 1 deletion src/karapace/core/karapace_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from __future__ import annotations

from dependency_injector.wiring import inject, Provide
from karapace.core import version as karapace_version
from karapace import version as karapace_version
from karapace.core.config import Config
from karapace.core.container import KarapaceContainer
from karapace.core.instrumentation.prometheus import PrometheusInstrumentation
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
)
from karapace.core.schema_references import LatestVersionReference, Reference
from karapace.core.typing import JsonObject, Mode, PrimaryInfo, SchemaId, Subject, Version
from karapace.api.messaging import KarapaceProducer
from karapace.api.reader import KafkaSchemaReader
from karapace.core.messaging import KarapaceProducer
from karapace.core.schema_reader import KafkaSchemaReader
from karapace.api.telemetry.tracer import Tracer

import asyncio
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/schema_registry/test_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from karapace.core.client import Client
from karapace.core.compatibility import CompatibilityModes
from karapace.core.typing import SchemaMetadata, SchemaRuleSet
from karapace.api.reader import SchemaType
from karapace.core.schema_reader import SchemaType
from tests.schemas.json_schemas import (
A_DINT_B_DINT_OBJECT_SCHEMA,
A_DINT_B_INT_OBJECT_SCHEMA,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_schema_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from karapace.core.offset_watcher import OffsetWatcher
from karapace.core.typing import PrimaryInfo
from karapace.core.utils import json_encode
from karapace.api.reader import KafkaSchemaReader
from karapace.core.schema_reader import KafkaSchemaReader
from tests.base_testcase import BaseTestCase
from tests.integration.test_master_coordinator import AlwaysAvailableSchemaReaderStoppper
from tests.integration.utils.kafka_server import KafkaServers
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from karapace.core.rapu import HTTPResponse
from karapace.core.schema_models import SchemaType, ValidatedTypedSchema
from karapace.api.container import SchemaRegistryContainer
from karapace.api.reader import KafkaSchemaReader
from karapace.core.schema_reader import KafkaSchemaReader
from unittest.mock import Mock, patch, PropertyMock

import asyncio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from karapace.core.forward_client import ForwardClient
from karapace.core.typing import PrimaryInfo
from karapace.api.controller import KarapaceSchemaRegistryController
from karapace.api.registry import KarapaceSchemaRegistry
from karapace.core.schema_registry import KarapaceSchemaRegistry
from karapace.api.routers.config import config_put
from unittest.mock import AsyncMock, Mock

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_in_memory_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from karapace.core.schema_type import SchemaType
from karapace.core.typing import SchemaId, Version
from pathlib import Path
from karapace.api.reader import KafkaSchemaReader
from karapace.core.schema_reader import KafkaSchemaReader
from typing import Final

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from karapace.core.schema_type import SchemaType
from karapace.core.typing import SchemaId, Version
from pytest import MonkeyPatch
from karapace.api.reader import (
from karapace.core.schema_reader import (
KafkaSchemaReader,
MAX_MESSAGES_TO_CONSUME_AFTER_STARTUP,
MAX_MESSAGES_TO_CONSUME_ON_STARTUP,
Expand Down Expand Up @@ -316,10 +316,10 @@ def test_handle_msg_delete_subject_logs(caplog: LogCaptureFixture, karapace_cont
database=database_mock,
)

with caplog.at_level(logging.WARNING, logger="karapace.api.reader"):
with caplog.at_level(logging.WARNING, logger="karapace.core.schema_reader"):
schema_reader._handle_msg_schema_hard_delete(key={"subject": "test-subject", "version": 2})
for log in caplog.records:
assert log.name == "karapace.api.reader"
assert log.name == "karapace.core.schema_reader"
assert log.levelname == "WARNING"
assert log.message == "Hard delete: version: Version(2) for subject: 'test-subject' did not exist, should have"

Expand Down Expand Up @@ -594,14 +594,14 @@ def test_message_error_handling(
consumer_messages = ([message],)
schema_reader = schema_reader_with_consumer_messages_factory(consumer_messages)

with caplog.at_level(logging.WARNING, logger="karapace.api.reader"):
with caplog.at_level(logging.WARNING, logger="karapace.core.schema_reader"):
with pytest.raises(test_case.expected_error):
schema_reader.handle_messages()

assert schema_reader.offset == 1
assert not schema_reader.ready()
for log in caplog.records:
assert log.name == "karapace.api.reader"
assert log.name == "karapace.core.schema_reader"
assert log.levelname == "WARNING"
assert log.message == test_case.expected_log_message

Expand Down Expand Up @@ -632,7 +632,7 @@ def test_message_error_handling_with_invalid_reference_schema_protobuf(
)
message_using_ref = message_factory(key=key_using_ref, value=value_using_ref)

with caplog.at_level(logging.WARN, logger="karapace.api.reader"):
with caplog.at_level(logging.WARN, logger="karapace.core.schema_reader"):
# When handling the corrupted schema
schema_reader = schema_reader_with_consumer_messages_factory(([message_ref],))

Expand All @@ -658,8 +658,8 @@ def test_message_error_handling_with_invalid_reference_schema_protobuf(
assert len(warn_records) == 2

# Check that different warnings are logged for each schema
assert warn_records[0].name == "karapace.api.reader"
assert warn_records[0].name == "karapace.core.schema_reader"
assert warn_records[0].message == "Schema is not valid ProtoBuf definition"

assert warn_records[1].name == "karapace.api.reader"
assert warn_records[1].name == "karapace.core.schema_reader"
assert warn_records[1].message == "Invalid Protobuf references"

0 comments on commit 4675e6a

Please sign in to comment.