Automatic style fix

This commit is contained in:
robot-clickhouse 2023-11-15 17:48:54 +00:00
parent 3e26161eaa
commit af2f986215

View File

@ -14,6 +14,7 @@ from helpers.wait_for_helpers import wait_for_merges
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
@pytest.fixture(scope="module")
def init_broken_s3(cluster):
yield start_s3_mock(cluster, "broken_s3", "8083")
@ -24,6 +25,7 @@ def broken_s3(init_broken_s3):
init_broken_s3.reset()
yield init_broken_s3
@pytest.fixture(scope="module")
def cluster():
try:
@ -47,7 +49,8 @@ def cluster():
def test_async_alter_move(cluster, broken_s3):
node = cluster.instances["node"]
node.query("""
node.query(
"""
CREATE TABLE moving_table_async
(
key UInt64,
@ -56,32 +59,43 @@ def test_async_alter_move(cluster, broken_s3):
ENGINE MergeTree()
ORDER BY tuple()
SETTINGS storage_policy = 'slow_s3'
""")
"""
)
node.query("INSERT INTO moving_table_async SELECT number, randomPrintableASCII(1000) FROM numbers(10000)")
node.query(
"INSERT INTO moving_table_async SELECT number, randomPrintableASCII(1000) FROM numbers(10000)"
)
broken_s3.setup_slow_answers(
timeout=5,
count=1000000,
)
node.query("ALTER TABLE moving_table_async MOVE PARTITION tuple() TO DISK 'broken_s3'", settings={'alter_move_to_space_execute_async': True}, timeout=10)
node.query(
"ALTER TABLE moving_table_async MOVE PARTITION tuple() TO DISK 'broken_s3'",
settings={"alter_move_to_space_execute_async": True},
timeout=10,
)
# not flaky, just introduce some wait
time.sleep(3)
for i in range(100):
count = node.query("SELECT count() FROM system.moves where table = 'moving_table_async'")
count = node.query(
"SELECT count() FROM system.moves where table = 'moving_table_async'"
)
if count == "1\n":
break
time.sleep(0.1)
else:
assert False, "Cannot find any moving background operation"
def test_sync_alter_move(cluster, broken_s3):
node = cluster.instances["node"]
node.query("""
node.query(
"""
CREATE TABLE moving_table_sync
(
key UInt64,
@ -90,16 +104,30 @@ def test_sync_alter_move(cluster, broken_s3):
ENGINE MergeTree()
ORDER BY tuple()
SETTINGS storage_policy = 'slow_s3'
""")
"""
)
node.query("INSERT INTO moving_table_sync SELECT number, randomPrintableASCII(1000) FROM numbers(10000)")
node.query(
"INSERT INTO moving_table_sync SELECT number, randomPrintableASCII(1000) FROM numbers(10000)"
)
broken_s3.reset()
node.query("ALTER TABLE moving_table_sync MOVE PARTITION tuple() TO DISK 'broken_s3'", timeout=30)
node.query(
"ALTER TABLE moving_table_sync MOVE PARTITION tuple() TO DISK 'broken_s3'",
timeout=30,
)
# not flaky, just introduce some wait
time.sleep(3)
assert node.query("SELECT count() FROM system.moves where table = 'moving_table_sync'") == "0\n"
assert (
node.query("SELECT count() FROM system.moves where table = 'moving_table_sync'")
== "0\n"
)
assert node.query("SELECT disk_name FROM system.parts WHERE table = 'moving_table_sync'") == "broken_s3\n"
assert (
node.query(
"SELECT disk_name FROM system.parts WHERE table = 'moving_table_sync'"
)
== "broken_s3\n"
)