mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Update test.py
This commit is contained in:
parent
c58468ce8d
commit
0e01991eb7
@ -3,7 +3,9 @@ import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node = cluster.add_instance('node', main_configs=["configs/config.xml"], with_zookeeper=True, stay_alive=True)
|
||||
node = cluster.add_instance(
|
||||
'node', main_configs=["configs/config.xml"], with_zookeeper=True, stay_alive=True
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@ -14,13 +16,24 @@ def started_cluster():
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
def replace_substring_to_substr(node):
|
||||
node.exec_in_container(["bash", "-c", "sed -i 's/substring/substr/g' /var/lib/clickhouse/metadata/default/file.sql"], user="root")
|
||||
node.exec_in_container((
|
||||
[
|
||||
"bash",
|
||||
"-c",
|
||||
"sed -i 's/substring/substr/g' /var/lib/clickhouse/metadata/default/file.sql",
|
||||
],
|
||||
user="root",
|
||||
)
|
||||
|
||||
|
||||
def test_attach_substr(started_cluster):
|
||||
# Initialize
|
||||
node.query("DROP TABLE IF EXISTS default.file")
|
||||
node.query("CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n ")
|
||||
node.query(
|
||||
"CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n "
|
||||
)
|
||||
|
||||
# Detach table file
|
||||
node.query("DETACH TABLE file")
|
||||
@ -31,10 +44,13 @@ def test_attach_substr(started_cluster):
|
||||
# Attach table file
|
||||
node.query("ATTACH TABLE file")
|
||||
|
||||
|
||||
def test_attach_substr_restart(started_cluster):
|
||||
# Initialize
|
||||
node.query("DROP TABLE IF EXISTS default.file")
|
||||
node.query("CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n ")
|
||||
node.query(
|
||||
"CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n "
|
||||
)
|
||||
|
||||
# Replace substring to substr
|
||||
replace_substring_to_substr(node)
|
||||
|
Loading…
Reference in New Issue
Block a user