blob: 73f49325e3056e228afc29cfc4a13e9a32334247 [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 Zhurba4bfd2ee2019-04-10 21:56:58 -05006 tgt='galera:*',
7 param='salt-call mysql.status | grep -A1 wsrep_cluster_size | tail -n1',
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00008 expr_form='pillar')
9
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050010 if not gs:
Oleksii Zhurba9848e212018-09-05 10:53:51 -050011 pytest.skip("Galera service or galera:* pillar \
12 are not found on this environment.")
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050013
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +000014 size_cluster = []
15 amount = len(gs)
16
17 for item in gs.values():
18 size_cluster.append(item.split('\n')[-1].strip())
19
20 assert all(item == str(amount) for item in size_cluster), \
21 '''There found inconsistency within cloud. MySQL galera cluster
22 is probably broken, the cluster size gathered from nodes:
23 {}'''.format(gs)