From ada0d47244bf372d8350a0456fb07321c6a54262 Mon Sep 17 00:00:00 2001 From: alsu Date: Wed, 10 Apr 2024 00:30:34 +0200 Subject: [PATCH] updates to part_names tests --- .../part_names/common_steps.py | 11 ++++++++ .../part_names/merge_increment.py | 28 ++++++++----------- .../part_names/part_level_reset.py | 9 +++--- .../attach_partition/part_names/part_names.py | 16 +++++------ 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/alter/table/attach_partition/part_names/common_steps.py b/alter/table/attach_partition/part_names/common_steps.py index 021a1887b..15f0e38b7 100644 --- a/alter/table/attach_partition/part_names/common_steps.py +++ b/alter/table/attach_partition/part_names/common_steps.py @@ -135,6 +135,17 @@ def update_table(self, table_name, update_column="a", node=None): ) +@TestStep +def insert_data(self, table_name, number_of_rows, node=None): + """Insert data into a table.""" + if node is None: + node = self.context.node + + node.query( + f"INSERT INTO {table_name} (id, a) SELECT number, number FROM numbers({number_of_rows})" + ) + + @TestStep def attach_partition_from(self, source_table, destination_table, partition, node=None): """Attach a partition from a source table to a destination table.""" diff --git a/alter/table/attach_partition/part_names/merge_increment.py b/alter/table/attach_partition/part_names/merge_increment.py index ac5c6b152..636d229f4 100644 --- a/alter/table/attach_partition/part_names/merge_increment.py +++ b/alter/table/attach_partition/part_names/merge_increment.py @@ -188,20 +188,14 @@ def merge_increment(self): "ReplicatedAggregatingMergeTree", ] - with Pool(2) as executor: - for engine in engines: - Scenario( - f"{engine}", - test=check_merge_increment, - parallel=True, - executor=executor, - )(engine=engine) - - with Pool(2) as executor: - for engine in replicated_engines: - Scenario( - f"{engine}", - test=check_merge_increment_replicated, - parallel=True, - executor=executor, - )(engine=engine) + for engine in engines: + Scenario( + f"{engine}", + test=check_merge_increment, + )(engine=engine) + + for engine in replicated_engines: + Scenario( + f"{engine}", + test=check_merge_increment_replicated, + )(engine=engine) diff --git a/alter/table/attach_partition/part_names/part_level_reset.py b/alter/table/attach_partition/part_names/part_level_reset.py index c6c7ddb07..23e3730ff 100644 --- a/alter/table/attach_partition/part_names/part_level_reset.py +++ b/alter/table/attach_partition/part_names/part_level_reset.py @@ -28,7 +28,7 @@ def check_part_level_reset(self, engine="MergeTree"): with And("I get part name"): part_name = node.query( - f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active" + f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active AND rows>0" ).output with And("I detach the part"): @@ -50,7 +50,7 @@ def check_part_level_reset(self, engine="MergeTree"): expected_part_name = "all_2_2_0" part_name = node.query( - f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active" + f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active AND rows>0" ) node.query(f"SELECT * FROM {source_table}") for attempt in retries(timeout=30, delay=2): @@ -83,7 +83,7 @@ def check_part_level_reset_replicated(self, engine): with And("I get part name"): node = random.choice(self.context.nodes) part_name = node.query( - f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active" + f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active AND rows>0" ).output with And("I detach the part"): @@ -99,7 +99,7 @@ def check_part_level_reset_replicated(self, engine): for node in self.context.nodes: part_name = node.query( - f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active" + f"SELECT name FROM system.parts WHERE table = '{source_table}' AND active AND rows>0" ) for attempt in retries(timeout=30, delay=2): with attempt: @@ -109,7 +109,6 @@ def check_part_level_reset_replicated(self, engine): @TestScenario -@Repeat(20) @Requirements( RQ_SRS_034_ClickHouse_Alter_Table_AttachPartition_PartNames_ChunkLevelReset("1.0") ) diff --git a/alter/table/attach_partition/part_names/part_names.py b/alter/table/attach_partition/part_names/part_names.py index d2732b001..14834985b 100644 --- a/alter/table/attach_partition/part_names/part_names.py +++ b/alter/table/attach_partition/part_names/part_names.py @@ -110,12 +110,12 @@ def feature(self): parallel=True, executor=executor, ) - Scenario( - run=load( - "alter.table.attach_partition.part_names.replicated_tables", - "replicated_tables", - ), - parallel=True, - executor=executor, - ) + # Scenario( + # run=load( + # "alter.table.attach_partition.part_names.replicated_tables", + # "replicated_tables", + # ), + # parallel=True, + # executor=executor, + # ) join()