Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
eliax1996 committed Jun 20, 2024
1 parent e3c51fc commit 7b969af
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/integration/test_schema_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from contextlib import closing
from dataclasses import dataclass
from io import StringIO
from karapace.config import set_config_defaults
from karapace.constants import DEFAULT_SCHEMA_TOPIC
from karapace.coordinator.master_coordinator import MasterCoordinator
Expand All @@ -21,6 +22,7 @@
from typing import List, Tuple

import asyncio
import contextlib
import pytest


Expand Down Expand Up @@ -287,3 +289,41 @@ async def test_key_format_detection(
assert key_formatter.get_keymode() == testcase.expected
finally:
await master_coordinator.close()

#todo: run process of `KafkaSchemaReader` in background and collect logs to assert that it started without any exception raised (or status code in error)
async def test_schema_topic_creation_is_needed(
kafka_servers: KafkaServers,
) -> None:
"""Test that the schema registry can start successfully if the cluster needs create the schema registry from zero."""
test_name = "test_regression_soft_delete_schemas_should_be_registered"
topic_name = new_random_name("topic")
group_id = create_group_name_factory(test_name)()

config = set_config_defaults(
{
"bootstrap_uri": kafka_servers.bootstrap_servers,
"admin_metadata_max_age": 2,
"group_id": group_id,
"topic_name": topic_name,
}
)
master_coordinator = MasterCoordinator(config=config)

try:
await master_coordinator.start()
database = InMemoryDatabase()
offset_watcher = OffsetWatcher()

schema_reader = KafkaSchemaReader(
config=config,
offset_watcher=offset_watcher,
key_formatter=KeyFormatter(),
master_coordinator=master_coordinator,
database=database,
)
schema_reader.start()

with closing(schema_reader):
await _wait_until_reader_is_ready_and_master(master_coordinator, schema_reader)
finally:
await master_coordinator.close()

0 comments on commit 7b969af

Please sign in to comment.