Skip to content

Commit 9395297

Browse files
committed
split_kafka_tests: black formatter
1 parent 3aaa5f2 commit 9395297

File tree

10 files changed

+32
-525
lines changed

10 files changed

+32
-525
lines changed

tests/integration/helpers/kafka/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from helpers.kafka.common_direct import *
22
from helpers.kafka.common_direct import _VarintBytes
33

4+
45
def get_kafka_producer(port, serializer, retries):
56
errors = []
67
for _ in range(retries):
@@ -465,6 +466,7 @@ def describe_consumer_group(kafka_cluster, name):
465466
res.append(member_info)
466467
return res
467468

469+
468470
KAFKA_TOPIC_OLD = "old_t"
469471
KAFKA_CONSUMER_GROUP_OLD = "old_cg"
470472
KAFKA_TOPIC_NEW = "new_t"

tests/integration/test_kafka_bad_messages/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from kafka.admin import NewTopic
77

88
from helpers.cluster import ClickHouseCluster, is_arm
9-
from helpers.kafka_common import (
9+
from helpers.kafka.common import (
1010
kafka_create_topic,
1111
kafka_delete_topic,
1212
get_kafka_producer,

tests/integration/test_kafka_bad_messages/test_1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from helpers.kafka_common import (
1+
from helpers.kafka.common import (
22
kafka_create_topic,
33
kafka_delete_topic,
44
get_kafka_producer,

tests/integration/test_storage_kafka/test_bacth_slow_3.py

Lines changed: 0 additions & 511 deletions
This file was deleted.

tests/integration/test_storage_kafka/test_batch_slow_0.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -59,7 +61,8 @@ def get_topics_to_delete():
5961
retries += 1
6062
time.sleep(0.5)
6163
yield # run test
62-
64+
65+
6366
# Tests
6467

6568
# TODO: add test for run-time offset update in CH, if we manually update it on Kafka side.
@@ -398,6 +401,7 @@ def test_kafka_formats_with_broken_message(kafka_cluster, create_query_generator
398401
), "Proper error for format: {}".format(format_name)
399402
k.kafka_delete_topic(admin_client, topic_name)
400403

404+
401405
@pytest.mark.parametrize(
402406
"create_query_generator",
403407
[k.generate_old_create_table_query, k.generate_new_create_table_query],
@@ -813,6 +817,7 @@ def test_kafka_formats(kafka_cluster, create_query_generator):
813817
)
814818
k.kafka_delete_topic(k.get_admin_client(kafka_cluster), topic_name)
815819

820+
816821
if __name__ == "__main__":
817822
cluster.start()
818823
input("Cluster created, press any key to destroy...")

tests/integration/test_storage_kafka/test_batch_slow_1.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -59,7 +61,8 @@ def get_topics_to_delete():
5961
retries += 1
6062
time.sleep(0.5)
6163
yield # run test
62-
64+
65+
6366
# Tests
6467

6568

tests/integration/test_storage_kafka/test_batch_slow_2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -59,9 +61,11 @@ def get_topics_to_delete():
5961
retries += 1
6062
time.sleep(0.5)
6163
yield # run test
62-
64+
65+
6366
# Tests
6467

68+
6569
@pytest.mark.parametrize(
6670
"create_query_generator",
6771
[k.generate_old_create_table_query, k.generate_new_create_table_query],

tests/integration/test_storage_kafka/test_batch_slow_4.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -60,8 +62,10 @@ def get_topics_to_delete():
6062
time.sleep(0.5)
6163
yield # run test
6264

65+
6366
# Tests
6467

68+
6569
@pytest.mark.parametrize(
6670
"create_query_generator",
6771
[
@@ -259,5 +263,3 @@ def test_kafka_consumer_failover(kafka_cluster, create_query_generator):
259263
prev_count = instance.query_with_retry(
260264
count_query, check_callback=lambda res: int(res) > prev_count
261265
)
262-
263-

tests/integration/test_storage_kafka/test_batch_slow_5.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -60,8 +62,10 @@ def get_topics_to_delete():
6062
time.sleep(0.5)
6163
yield # run test
6264

65+
6366
# Tests
6467

68+
6569
def test_formats_errors(kafka_cluster):
6670
admin_client = KafkaAdminClient(
6771
bootstrap_servers="localhost:{}".format(kafka_cluster.kafka_port)
@@ -151,5 +155,3 @@ def test_formats_errors(kafka_cluster):
151155

152156
instance.query(f"DROP TABLE test.{table_name}")
153157
instance.query("DROP TABLE test.view")
154-
155-

tests/integration/test_storage_kafka/test_batch_slow_6.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
clickhouse_path_dir="clickhouse_path",
2323
)
2424

25+
2526
# Fixtures
2627
@pytest.fixture(scope="module")
2728
def kafka_cluster():
@@ -33,6 +34,7 @@ def kafka_cluster():
3334
finally:
3435
cluster.shutdown()
3536

37+
3638
@pytest.fixture(autouse=True)
3739
def kafka_setup_teardown():
3840
instance.query("DROP DATABASE IF EXISTS test SYNC; CREATE DATABASE test;")
@@ -60,8 +62,10 @@ def get_topics_to_delete():
6062
time.sleep(0.5)
6163
yield # run test
6264

65+
6366
# Tests
6467

68+
6569
def test_kafka_handling_commit_failure(kafka_cluster):
6670
messages = [json.dumps({"key": j + 1, "value": "x" * 300}) for j in range(22)]
6771
k.kafka_produce(kafka_cluster, "handling_commit_failure", messages)
@@ -100,9 +104,7 @@ def test_kafka_handling_commit_failure(kafka_cluster):
100104
# while materialized view is working to inject zookeeper failure
101105

102106
with kafka_cluster.pause_container("kafka1"):
103-
instance.wait_for_log_line(
104-
"timeout", timeout=60, look_behind_lines=100
105-
)
107+
instance.wait_for_log_line("timeout", timeout=60, look_behind_lines=100)
106108

107109
# kafka_cluster.open_bash_shell('instance')
108110
instance.wait_for_log_line("Committed offset 22")
@@ -363,5 +365,3 @@ def produce():
363365
kafka_thread.join()
364366

365367
assert result == 1, "Messages from kafka get duplicated!"
366-
367-

0 commit comments

Comments
 (0)