Skip to content

Commit

Permalink
tests/system: fix ILM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed Nov 29, 2019
1 parent 284f94b commit 270266e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/system/test_setup_index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -321,7 +322,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
Expand Down

0 comments on commit 270266e

Please sign in to comment.