blob: 676f09bca0c1ed4047b454b88b84442945a5a8c7 [file] [log] [blame]
Oleksii Zhurba3dbed242017-10-31 19:58:53 +00001import pytest
2
3
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00004def test_galera_cluster_status(local_salt_client):
5 gs = local_salt_client.cmd(
Oleksii Zhurba3d0b2202017-10-05 16:52:01 -05006 'galera:*',
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00007 'cmd.run',
8 ['salt-call mysql.status | grep -A1 wsrep_cluster_size | tail -n1'],
9 expr_form='pillar')
10
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050011 if not gs:
Oleksii Zhurba9848e212018-09-05 10:53:51 -050012 pytest.skip("Galera service or galera:* pillar \
13 are not found on this environment.")
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050014
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +000015 size_cluster = []
16 amount = len(gs)
17
18 for item in gs.values():
19 size_cluster.append(item.split('\n')[-1].strip())
20
21 assert all(item == str(amount) for item in size_cluster), \
22 '''There found inconsistency within cloud. MySQL galera cluster
23 is probably broken, the cluster size gathered from nodes:
24 {}'''.format(gs)