userver: samples/kafka_service/testsuite/conftest.py
Loading...
Searching...
No Matches
samples/kafka_service/testsuite/conftest.py
1import pytest
2
3# /// [Kafka service sample - kafka testsuite include]
4
5pytest_plugins = ['pytest_userver.plugins.kafka']
6
7# /// [Kafka service sample - kafka testsuite include]
8
9
10# /// [Kafka service sample - secdist]
11@pytest.fixture(scope='session')
12def service_env(kafka_secdist) -> dict:
13 """
14 Note: kafka_secist fixture generates the secdist config
15
16 Expected secdist format is:
17 "kafka_settings": {
18 "<kafka-component-name>": {
19 "brokers": "<brokers comma-separated endpoint list>",
20 "username": "SASL2 username (may be empty if use PLAINTEXT)",
21 "password": "SASL2 password (may be empty if use PLAINTEXT)"
22 }
23 }
24 """
25
26 return {'SECDIST_CONFIG': kafka_secdist}
27 # /// [Kafka service sample - secdist]
28
29
30@pytest.fixture(scope='session')
31def kafka_local(_patched_bootstrap_servers_internal):
32 """
33 Note: Should not be used, if using basic Kafka testsuite plugin.
34
35 kafka_local is testsuite's fixture that is redefined
36 to use custom Kafka cluster,
37 but with kafka_producer and kafka_consumer fixtures.
38 Here is only needed for internal testing purposes.
39 """
40 return _patched_bootstrap_servers_internal