Oleksii Zhurba | 3dbed24 | 2017-10-31 19:58:53 +0000 | [diff] [blame] | 1 | import pytest |
| 2 | |
| 3 | |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 4 | def test_galera_cluster_status(local_salt_client): |
| 5 | gs = local_salt_client.cmd( |
Oleksii Zhurba | 3d0b220 | 2017-10-05 16:52:01 -0500 | [diff] [blame] | 6 | 'galera:*', |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 7 | 'cmd.run', |
| 8 | ['salt-call mysql.status | grep -A1 wsrep_cluster_size | tail -n1'], |
| 9 | expr_form='pillar') |
| 10 | |
Oleksii Zhurba | 0ee1814 | 2017-10-05 17:15:05 -0500 | [diff] [blame] | 11 | if not gs: |
Oleksii Zhurba | 9848e21 | 2018-09-05 10:53:51 -0500 | [diff] [blame] | 12 | pytest.skip("Galera service or galera:* pillar \ |
| 13 | are not found on this environment.") |
Oleksii Zhurba | 0ee1814 | 2017-10-05 17:15:05 -0500 | [diff] [blame] | 14 | |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 15 | 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) |