blob: 2407a6321813d39b8dc970652fa88fb6b32bbfc5 [file] [log] [blame]
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00001import pytest
2import cvp_checks.utils as utils
3
4
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -05005@pytest.fixture(scope='session')
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00006def local_salt_client():
7 return utils.init_salt_client()
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -05008
9nodes = utils.calculate_groups()
10
Oleksii Zhurbae592ed12018-06-21 18:01:09 -050011
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -050012@pytest.fixture(scope='session', params=nodes.values(), ids=nodes.keys())
13def nodes_in_group(request):
14 return request.param
Mikhail Chernike6d470f2018-08-08 18:29:57 +020015
16
17def pytest_namespace():
18 return {'contrail': None}
19
20
21@pytest.fixture(scope='module')
22def contrail(local_salt_client):
23 probe = local_salt_client.cmd(
24 'opencontrail:control',
25 'pillar.get',
26 'opencontrail:control:version',
27 expr_form='pillar')
28 if not probe:
29 pytest.skip("Contrail is not found on this environment")
30 versions = set(probe.values())
31 if len(versions) != 1:
32 pytest.fail('Contrail versions are not the same: {}'.format(probe))
33 pytest.contrail = str(versions.pop())[:1]