blob: 32b107404a17398fa8f2942a4cb2ad321941b302 [file] [log] [blame]
Oleksii Zhurba3dbed242017-10-31 19:58:53 +00001import pytest
2
3
Oleksii Zhurba23c18332019-05-09 18:53:40 -05004@pytest.mark.sl_dup
5#GaleraServiceDown
6#TODO: a better test
7@pytest.mark.full
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00008def test_galera_cluster_status(local_salt_client):
9 gs = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030010 tgt='galera:*',
11 param='salt-call mysql.status | grep -A1 wsrep_cluster_size | tail -n1',
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +000012 expr_form='pillar')
13
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050014 if not gs:
Oleksii Zhurba9848e212018-09-05 10:53:51 -050015 pytest.skip("Galera service or galera:* pillar \
16 are not found on this environment.")
Oleksii Zhurba0ee18142017-10-05 17:15:05 -050017
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +000018 size_cluster = []
19 amount = len(gs)
20
21 for item in gs.values():
22 size_cluster.append(item.split('\n')[-1].strip())
23
24 assert all(item == str(amount) for item in size_cluster), \
25 '''There found inconsistency within cloud. MySQL galera cluster
26 is probably broken, the cluster size gathered from nodes:
27 {}'''.format(gs)