Coverage for tests/integration/test_basic_frozen.py: 95%
33 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-27 07:35 -0600
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-27 07:35 -0600
1"""Test functions in es_testbed.TestBed"""
3# pylint: disable=redefined-outer-name,missing-docstring
4import pytest
5from es_testbed import PlanBuilder, TestBed
8@pytest.fixture(scope='module')
9def settings(prefix, uniq, repo):
10 if not repo: 10 ↛ 11line 10 didn't jump to line 11, because the condition on line 10 was never true
11 pytest.skip('No snapshot repository', allow_module_level=True)
12 return {
13 'type': 'indices',
14 'prefix': prefix,
15 'rollover_alias': False,
16 'repository': repo,
17 'uniq': uniq,
18 'defaults': {
19 'entity_count': 3,
20 'docs': 10,
21 'match': True,
22 'searchable': 'frozen',
23 },
24 }
27class TestManualFrozenIndices:
28 @pytest.fixture(scope="class")
29 def tb(self, client, settings):
30 theplan = PlanBuilder(settings=settings).plan
31 teebee = TestBed(client, plan=theplan)
32 teebee.setup()
33 yield teebee
34 teebee.teardown()
36 def test_entity_count(self, tb):
37 assert len(tb.tracker.entities.entity_list) == 3
39 def test_first_index(self, tb, frozen, namecore):
40 value = f'{frozen}{namecore("index")}-000001'
41 assert tb.tracker.entities.entity_list[0].name == value
43 def test_last_index(self, tb, frozen, namecore):
44 value = f'{frozen}{namecore("index")}-000003'
45 assert tb.tracker.entities.last.name == value
47 def test_index_template(self, tb, namecore):
48 components = []
49 components.append(f'{namecore("component")}-000001')
50 components.append(f'{namecore("component")}-000002')
51 assert tb.tracker.components.entity_list == components
52 template = f'{namecore("template")}-000001'
53 assert tb.tracker.templates.last == template
54 result = tb.client.indices.get_index_template(name=template)['index_templates']
55 assert len(result) == 1
56 assert result[0]['index_template']['composed_of'] == components