From 6ce09daa4d25036bfdd7cf21a8831eae8b5836a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 23 Nov 2020 16:08:54 +0100 Subject: [PATCH] adjust E2E tests --- libbeat/tests/system/idxmgmt.py | 10 +++++++++- .../tests/system/test_cmd_setup_index_management.py | 8 ++++---- libbeat/tests/system/test_ilm.py | 4 ++-- libbeat/tests/system/test_template.py | 4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/libbeat/tests/system/idxmgmt.py b/libbeat/tests/system/idxmgmt.py index 864d134a9c98..4ec01a8cd5bf 100644 --- a/libbeat/tests/system/idxmgmt.py +++ b/libbeat/tests/system/idxmgmt.py @@ -56,11 +56,19 @@ def assert_index_template_not_loaded(self, template): with pytest.raises(NotFoundError): self._client.transport.perform_request('GET', '/_template/' + template) - def assert_index_template_loaded(self, template): + def assert_legacy_index_template_loaded(self, template): resp = self._client.transport.perform_request('GET', '/_template/' + template) assert template in resp assert "lifecycle" not in resp[template]["settings"]["index"] + def assert_index_template_loaded(self, template): + resp = self._client.transport.perform_request('GET', '/_index_template/' + template) + found = False + for index_template in resp['index_templates']: + if index_template['name'] == template: + found = True + assert found + def assert_ilm_template_loaded(self, template, policy, alias): resp = self._client.transport.perform_request('GET', '/_template/' + template) assert resp[template]["settings"]["index"]["lifecycle"]["name"] == policy diff --git a/libbeat/tests/system/test_cmd_setup_index_management.py b/libbeat/tests/system/test_cmd_setup_index_management.py index 234f4e76a0b8..cd6d19eefbe4 100644 --- a/libbeat/tests/system/test_cmd_setup_index_management.py +++ b/libbeat/tests/system/test_cmd_setup_index_management.py @@ -110,7 +110,7 @@ def test_setup_ilm_disabled(self): "-E", "setup.ilm.enabled=false"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.index_name) + self.idxmgmt.assert_legacy_index_template_loaded(self.index_name) self.idxmgmt.assert_alias_not_created(self.alias_name) self.idxmgmt.assert_policy_not_created(self.policy_name) @@ -242,7 +242,7 @@ def test_setup_template_name_and_pattern_on_ilm_disabled(self): "-E", "setup.template.pattern=" + self.custom_template + "*"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.custom_template) + self.idxmgmt.assert_legacy_index_template_loaded(self.custom_template) self.idxmgmt.assert_index_template_index_pattern(self.custom_template, [self.custom_template + "*"]) self.idxmgmt.assert_alias_not_created(self.alias_name) self.idxmgmt.assert_policy_not_created(self.policy_name) @@ -261,7 +261,7 @@ def test_setup_template_with_opts(self): "-E", "setup.template.settings.index.number_of_shards=2"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.index_name) + self.idxmgmt.assert_legacy_index_template_loaded(self.index_name) # check that settings are overwritten resp = self.es.transport.perform_request('GET', '/_template/' + self.index_name) @@ -284,7 +284,7 @@ def test_setup_overwrite_template_on_ilm_policy_created(self): "-E", "setup.template.name=" + self.custom_alias, "-E", "setup.template.pattern=" + self.custom_alias + "*"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.custom_alias) + self.idxmgmt.assert_legacy_index_template_loaded(self.custom_alias) self.idxmgmt.assert_policy_not_created(self.policy_name) # ensure ilm policy is created, triggering overwriting existing template diff --git a/libbeat/tests/system/test_ilm.py b/libbeat/tests/system/test_ilm.py index 3d37125f6e4a..2913893e11c2 100644 --- a/libbeat/tests/system/test_ilm.py +++ b/libbeat/tests/system/test_ilm.py @@ -68,7 +68,7 @@ def test_ilm_disabled(self): self.wait_until(lambda: self.log_contains("PublishEvents: 1 events have been published")) proc.check_kill_and_wait() - self.idxmgmt.assert_index_template_loaded(self.index_name) + self.idxmgmt.assert_legacy_index_template_loaded(self.index_name) self.idxmgmt.assert_alias_not_created(self.alias_name) self.idxmgmt.assert_policy_not_created(self.policy_name) @@ -234,7 +234,7 @@ def test_setup_ilm_disabled(self): "-E", "setup.ilm.enabled=false"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.index_name) + self.idxmgmt.assert_legacy_index_template_loaded(self.index_name) self.idxmgmt.assert_alias_not_created(self.alias_name) self.idxmgmt.assert_policy_not_created(self.policy_name) diff --git a/libbeat/tests/system/test_template.py b/libbeat/tests/system/test_template.py index 2e58c7753146..28f41688cbed 100644 --- a/libbeat/tests/system/test_template.py +++ b/libbeat/tests/system/test_template.py @@ -267,7 +267,7 @@ def test_setup_template_with_opts(self): "-E", "setup.template.settings.index.number_of_shards=2"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.index_name) + self.idxmgmt.assert_legacy_index_template_loaded(self.index_name) # check that settings are overwritten resp = self.es.transport.perform_request('GET', '/_template/' + self.index_name) @@ -305,7 +305,7 @@ def test_template_created_on_ilm_policy_created(self): "-E", "setup.template.name=" + self.custom_alias, "-E", "setup.template.pattern=" + self.custom_alias + "*"]) assert exit_code == 0 - self.idxmgmt.assert_index_template_loaded(self.custom_alias) + self.idxmgmt.assert_legacy_index_template_loaded(self.custom_alias) self.idxmgmt.assert_policy_not_created(self.policy_name) # ensure ilm policy is created, triggering overwriting existing template