diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py index dfd964b04d2..96da7a57b60 100644 --- a/tests/integration/helpers/cluster.py +++ b/tests/integration/helpers/cluster.py @@ -3918,7 +3918,11 @@ class ClickHouseInstance: return None def restart_with_original_version( - self, stop_start_wait_sec=300, callback_onstop=None, signal=15 + self, + stop_start_wait_sec=300, + callback_onstop=None, + signal=15, + clear_data_dir=False, ): begin_time = time.time() if not self.stay_alive: @@ -3946,6 +3950,17 @@ class ClickHouseInstance: if callback_onstop: callback_onstop(self) + + if clear_data_dir: + self.exec_in_container( + [ + "bash", + "-c", + "rm -rf /var/lib/clickhouse/metadata && rm -rf /var/lib/clickhouse/data", + ], + user="root", + ) + self.exec_in_container( [ "bash", diff --git a/tests/integration/test_backward_compatibility/test_aggregate_function_state.py b/tests/integration/test_backward_compatibility/test_aggregate_function_state.py index 3a936239cc8..7789d13be0b 100644 --- a/tests/integration/test_backward_compatibility/test_aggregate_function_state.py +++ b/tests/integration/test_backward_compatibility/test_aggregate_function_state.py @@ -35,6 +35,12 @@ def start_cluster(): cluster.shutdown() +@pytest.fixture(autouse=True) +def cleanup(): + yield + node1.restart_with_original_version(clear_data_dir=True) + + # We will test that serialization of internal state of "avg" function is compatible between different versions. # TODO Implement versioning of serialization format for aggregate function states. # NOTE This test is too ad-hoc. @@ -143,7 +149,7 @@ def test_backward_compatability_for_uniq_exact(start_cluster, uniq_keys): == f"{uniq_keys}\n" ) - node1.restart_with_latest_version() + node1.restart_with_latest_version(fix_metadata=True) assert ( node1.query(f"SELECT uniqExactMerge(x) FROM state_{uniq_keys}") @@ -216,7 +222,7 @@ def test_backward_compatability_for_uniq_exact_variadic(start_cluster, uniq_keys == f"{uniq_keys}\n" ) - node1.restart_with_latest_version() + node1.restart_with_latest_version(fix_metadata=True) assert ( node1.query(f"SELECT uniqExactMerge(x) FROM state_{uniq_keys}")