From 15d1b8f397b70a0ff066aa6d17a608e882825828 Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 17 May 2021 14:29:32 +0000 Subject: [PATCH] Add test --- .../test_version_update/__init__.py | 0 tests/integration/test_version_update/test.py | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/integration/test_version_update/__init__.py create mode 100644 tests/integration/test_version_update/test.py diff --git a/tests/integration/test_version_update/__init__.py b/tests/integration/test_version_update/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/integration/test_version_update/test.py b/tests/integration/test_version_update/test.py new file mode 100644 index 00000000000..ecf24a7b194 --- /dev/null +++ b/tests/integration/test_version_update/test.py @@ -0,0 +1,28 @@ +import pytest + +from helpers.cluster import ClickHouseCluster + +cluster = ClickHouseCluster(__file__) + +node1 = cluster.add_instance('node1', with_zookeeper=True, image='yandex/clickhouse-server', tag='21.2', with_installed_binary=True, stay_alive=True) + + +@pytest.fixture(scope="module") +def start_cluster(): + try: + cluster.start() + yield cluster + + finally: + cluster.shutdown() + + +def test_modulo_partition_key_after_update(start_cluster): + node1.query("CREATE TABLE test (id Int64, v UInt64, value String) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/table1', '1', v) PARTITION BY id % 20 ORDER BY (id, v)") + node1.query("INSERT INTO test SELECT number, number, toString(number) FROM numbers(10)") + expected = node1.query("SELECT number, number, toString(number) FROM numbers(10)") + partition_data = node1.query("SELECT partition, name FROM system.parts WHERE table='test' ORDER BY partition") + assert(expected == node1.query("SELECT * FROM test ORDER BY id")) + node1.restart_with_latest_version(signal=9) + assert(expected == node1.query("SELECT * FROM test ORDER BY id")) + assert(partition_data == node1.query("SELECT partition, name FROM system.parts WHERE table='test' ORDER BY partition"))