Skip to content

Commit

Permalink
updates to part_names tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alsugiliazova committed Apr 9, 2024
1 parent 8904f19 commit ada0d47
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
11 changes: 11 additions & 0 deletions alter/table/attach_partition/part_names/common_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
28 changes: 11 additions & 17 deletions alter/table/attach_partition/part_names/merge_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 4 additions & 5 deletions alter/table/attach_partition/part_names/part_level_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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):
Expand Down Expand Up @@ -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"):
Expand All @@ -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:
Expand All @@ -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")
)
Expand Down
16 changes: 8 additions & 8 deletions alter/table/attach_partition/part_names/part_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit ada0d47

Please sign in to comment.