Oleksii Zhurba | 3dbed24 | 2017-10-31 19:58:53 +0000 | [diff] [blame] | 1 | import pytest |
| 2 | |
| 3 | |
Oleksii Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame^] | 4 | @pytest.mark.sl_dup |
| 5 | #GaleraServiceDown |
| 6 | #TODO: a better test |
| 7 | @pytest.mark.full |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 8 | def test_galera_cluster_status(local_salt_client): |
| 9 | gs = local_salt_client.cmd( |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 10 | tgt='galera:*', |
| 11 | param='salt-call mysql.status | grep -A1 wsrep_cluster_size | tail -n1', |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 12 | expr_form='pillar') |
| 13 | |
Oleksii Zhurba | 0ee1814 | 2017-10-05 17:15:05 -0500 | [diff] [blame] | 14 | if not gs: |
Oleksii Zhurba | 9848e21 | 2018-09-05 10:53:51 -0500 | [diff] [blame] | 15 | pytest.skip("Galera service or galera:* pillar \ |
| 16 | are not found on this environment.") |
Oleksii Zhurba | 0ee1814 | 2017-10-05 17:15:05 -0500 | [diff] [blame] | 17 | |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 18 | 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) |