From dd896d29f46b61f826f854bb525564bc1f13c020 Mon Sep 17 00:00:00 2001 From: alz Date: Fri, 28 Feb 2025 20:26:49 +0300 Subject: [PATCH] Extend a test for no_restart rules --- .../manifests/chi/test-055-chopconf-3.yaml | 6 +++--- .../manifests/chi/test-055-chopconf-4.yaml | 19 +++++++++++++++++++ tests/e2e/test_operator.py | 12 +++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 tests/e2e/manifests/chi/test-055-chopconf-4.yaml diff --git a/tests/e2e/manifests/chi/test-055-chopconf-3.yaml b/tests/e2e/manifests/chi/test-055-chopconf-3.yaml index 2b79bb4b6..882af2a85 100644 --- a/tests/e2e/manifests/chi/test-055-chopconf-3.yaml +++ b/tests/e2e/manifests/chi/test-055-chopconf-3.yaml @@ -11,9 +11,9 @@ spec: clusters: - name: default files: - config.d/test.xml: | - + config.d/test_no_restart.xml: | + test - + \ No newline at end of file diff --git a/tests/e2e/manifests/chi/test-055-chopconf-4.yaml b/tests/e2e/manifests/chi/test-055-chopconf-4.yaml new file mode 100644 index 000000000..33dba7ad8 --- /dev/null +++ b/tests/e2e/manifests/chi/test-055-chopconf-4.yaml @@ -0,0 +1,19 @@ +apiVersion: "clickhouse.altinity.com/v1" +kind: "ClickHouseInstallation" + +metadata: + name: test-055-chopconf + +spec: + useTemplates: + - name: clickhouse-version + configuration: + clusters: + - name: default + files: + config.d/test_restart.xml: | + + + test + + diff --git a/tests/e2e/test_operator.py b/tests/e2e/test_operator.py index 3053e5f86..aaf38566d 100644 --- a/tests/e2e/test_operator.py +++ b/tests/e2e/test_operator.py @@ -5289,12 +5289,22 @@ def test_055(self): res = clickhouse.query_with_error(chi, "select count() from test_055") assert res != "0" - with When(f"Add configuration file that SHOULD NOT be ignored by restart rules"): + with When(f"Add another configuration file that SHOULD be ignored by restart rules"): kubectl.create_and_check( manifest="manifests/chi/test-055-chopconf-3.yaml", check={"do_not_delete": 1}, ) + with Then("ClickHouse SHOULD NOT be restarted"): + new_start_time = kubectl.get_clickhouse_start(chi) + assert start_time == new_start_time + + with When(f"Add configuration file that SHOULD NOT be ignored by restart rules"): + kubectl.create_and_check( + manifest="manifests/chi/test-055-chopconf-4.yaml", + check={"do_not_delete": 1}, + ) + with Then("ClickHouse SHOULD be restarted"): new_start_time = kubectl.get_clickhouse_start(chi) assert start_time != new_start_time