From a64bb70bc821d0d9c8dfd92198db7968b4f3daed Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Wed, 27 Nov 2019 20:43:31 +0800 Subject: [PATCH] tests/system: fix ILM tests --- tests/system/test_setup_index_management.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/system/test_setup_index_management.py b/tests/system/test_setup_index_management.py index 3a0692a67a6..af4a3c1e75b 100644 --- a/tests/system/test_setup_index_management.py +++ b/tests/system/test_setup_index_management.py @@ -8,13 +8,14 @@ INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False) +EVENT_NAMES = ('error', 'span', 'transaction', 'metric', 'profile') class IdxMgmt(object): def __init__(self, client, index): self._client = client self._index = index - self._event_indices = ["{}-{}".format(self._index, e) for e in ['error', 'span', 'transaction', 'metric']] + self._event_indices = ["{}-{}".format(self._index, e) for e in EVENT_NAMES] self.default_policy = "apm-rollover-30-days" def indices(self): @@ -40,7 +41,7 @@ def assert_template(self, loaded=1): s, i, l = 'settings', 'index', 'lifecycle' assert l not in resp[self._index][s][i] - def assert_event_template(self, loaded=4, with_ilm=True): + def assert_event_template(self, loaded=len(EVENT_NAMES), with_ilm=True): resp = self._client.indices.get_template(name=self._index + '*', ignore=[404]) if self._index in resp: @@ -60,7 +61,7 @@ def assert_event_template(self, loaded=4, with_ilm=True): assert t[l]['name'] is not None, t[l] assert t[l]['rollover_alias'] == idx, t[l] - def assert_alias(self, loaded=4): + def assert_alias(self, loaded=len(EVENT_NAMES)): resp = self._client.transport.perform_request('GET', '/_alias/' + self._index + '*') if loaded == 0: return self.assert_empty(resp) @@ -302,7 +303,7 @@ def test_ilm_loaded(self): max_timeout=5) self.idxmgmt.assert_event_template(with_ilm=True) - self.idxmgmt.assert_alias(loaded=4) + self.idxmgmt.assert_alias() self.idxmgmt.assert_default_policy(loaded=True) # check out configured policy in apm-server.yml.j2