LocalRedpandaBroker
fastkafka.testing.LocalRedpandaBroker
​
LocalRedpandaBroker class, used for running unique redpanda brokers in tests to prevent topic clashing.
__init__
​
def __init__(self, topics: Iterable[str] = [], retries: int = 3, apply_nest_asyncio: bool = False, listener_port: int = 9092, tag: str = 'v23.1.2', seastar_core: int = 1, memory: str = '1G', mode: str = 'dev-container', default_log_level: str = 'debug', **kwargs: Dict[str, Any]) -> None
Initialises the LocalRedpandaBroker object
Parameters:
listener_port
: Port on which the clients (producers and consumers) can connecttag
: Tag of Redpanda image to use to start containerseastar_core
: Core(s) to use byt Seastar (the framework Redpanda uses under the hood)memory
: The amount of memory to make available to Redpandamode
: Mode to use to load configuration properties in containerdefault_log_level
: Log levels to use for Redpanda
get_service_config_string
​
def get_service_config_string(self, service: str, data_dir: pathlib.Path) -> str
Generates a configuration for a service
Parameters:
data_dir
: Path to the directory where the zookeepeer instance will save dataservice
: "redpanda", defines which service to get config string for
start
​
def start(self: fastkafka.testing.LocalRedpandaBroker) -> str
Starts a local redpanda broker instance synchronously
Returns:
- Redpanda broker bootstrap server address in string format: add:port
stop
​
def stop(self: fastkafka.testing.LocalRedpandaBroker) -> None
Stops a local redpanda broker instance synchronously
Returns:
- None