From a056379ec1028eb1de6da0bb78c6aefb9d912bff Mon Sep 17 00:00:00 2001 From: alesapin Date: Mon, 9 Nov 2020 12:25:50 +0300 Subject: [PATCH] Remove duplicate code --- .../__init__.py | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/tests/integration/test_limited_replicated_fetches/__init__.py b/tests/integration/test_limited_replicated_fetches/__init__.py index 900e89d8bcf..e69de29bb2d 100644 --- a/tests/integration/test_limited_replicated_fetches/__init__.py +++ b/tests/integration/test_limited_replicated_fetches/__init__.py @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 - -import pytest -import time -from helpers.cluster import ClickHouseCluster -from helpers.network import PartitionManager -import random -import string - -cluster = ClickHouseCluster(__file__) -node1 = cluster.add_instance('node1', with_zookeeper=True) -node2 = cluster.add_instance('node2', with_zookeeper=True) - -DEFAULT_MAX_THREADS_FOR_FETCH = 3 - -@pytest.fixture(scope="module") -def started_cluster(): - try: - cluster.start() - - yield cluster - - finally: - cluster.shutdown() - - -def get_random_string(length): - return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length)) - -def test_limited_fetches(started_cluster): - node1.query("CREATE TABLE t (key UInt64, data String) ENGINE = ReplicatedMergeTree('/clickhouse/test/t', '1') ORDER BY tuple() PARTITION BY key") - node2.query("CREATE TABLE t (key UInt64, data String) ENGINE = ReplicatedMergeTree('/clickhouse/test/t', '2') ORDER BY tuple() PARTITION BY key") - - with PartitionManager() as pm: - node2.query("SYSTEM STOP FETCHES t") - node1.query("INSERT INTO t SELECT 1, '{}' FROM numbers(5000)".format(get_random_string(104857))) - node1.query("INSERT INTO t SELECT 2, '{}' FROM numbers(5000)".format(get_random_string(104857))) - node1.query("INSERT INTO t SELECT 3, '{}' FROM numbers(5000)".format(get_random_string(104857))) - node1.query("INSERT INTO t SELECT 4, '{}' FROM numbers(5000)".format(get_random_string(104857))) - node1.query("INSERT INTO t SELECT 5, '{}' FROM numbers(5000)".format(get_random_string(104857))) - node1.query("INSERT INTO t SELECT 6, '{}' FROM numbers(5000)".format(get_random_string(104857))) - pm.add_network_delay(node1, 80) - node2.query("SYSTEM START FETCHES t") - fetches_result = [] - for _ in range(1000): - result = node2.query("SELECT result_part_name FROM system.replicated_fetches") - if not result: - if fetches_result: - break - time.sleep(0.1) - else: - fetches_result.append(result.split('\n')) - print(fetches_result[-1]) - time.sleep(0.1) - - for concurrently_fetching_parts in fetches_result: - if len(concurrently_fetching_parts) > DEFAULT_MAX_THREADS_FOR_FETCH: - assert False, "Found more than {} concurrently fetching parts: {}".format(DEFAULT_MAX_THREADS_FOR_FETCH, ', '.join(concurrently_fetching_parts))