[improve]change the integration test test_multiple_disks::test_move_across_policies_not_work to test_move_across_policies_work_for_attach_not_work_for_move

This commit is contained in:
unashi 2024-02-21 10:55:32 +08:00
parent 28282eee91
commit 1731a5a8af

View File

@ -5,6 +5,7 @@ import string
import threading
import time
from multiprocessing.dummy import Pool
from helpers.test_tools import assert_eq_with_retry
import pytest
from helpers.client import QueryRuntimeException
@ -1745,9 +1746,9 @@ def test_move_while_merge(start_cluster):
node1.query(f"DROP TABLE IF EXISTS {name} SYNC")
def test_move_across_policies_does_not_work(start_cluster):
def test_move_across_policies_work_for_attach_not_work_for_move(start_cluster):
try:
name = "test_move_across_policies_does_not_work"
name = "test_move_across_policies_work_for_attach_not_work_for_move"
node1.query(
"""
@ -1783,25 +1784,18 @@ def test_move_across_policies_does_not_work(start_cluster):
except QueryRuntimeException:
"""All parts of partition 'all' are already on disk 'jbod2'."""
with pytest.raises(
QueryRuntimeException,
match=".*because disk does not belong to storage policy.*",
):
node1.query(
"""ALTER TABLE {name}2 ATTACH PARTITION tuple() FROM {name}""".format(
name=name
)
node1.query(
"""ALTER TABLE {name}2 ATTACH PARTITION tuple() FROM {name}""".format(
name=name
)
with pytest.raises(
QueryRuntimeException,
match=".*because disk does not belong to storage policy.*",
):
)
assert_eq_with_retry(
node1,
"""SELECT * FROM {name}2""".format(name=name),
node1.query(
"""ALTER TABLE {name}2 REPLACE PARTITION tuple() FROM {name}""".format(
name=name
)
)
"""SELECT * FROM {name}""".format(name=name),
),
)
with pytest.raises(
QueryRuntimeException,
@ -1813,10 +1807,6 @@ def test_move_across_policies_does_not_work(start_cluster):
)
)
assert node1.query(
"""SELECT * FROM {name}""".format(name=name)
).splitlines() == ["1"]
finally:
node1.query(f"DROP TABLE IF EXISTS {name} SYNC")
node1.query(f"DROP TABLE IF EXISTS {name}2 SYNC")