blob: c9ba9ced2d4ba6c0e43b99cf20b1dfbf1b254fc3 [file] [log] [blame]
Ievgeniia Zadorozhna45ae6b62019-03-05 18:52:44 +03001import json
2import pytest
3
4
5def test_mounted_file_systems(local_salt_client, nodes_in_group):
6 """
7 # Get all mount points from each node in the group with the next command: `df -h | awk '{print $1}'`
8 # Check that all mount points are similar for each node in the group
9 """
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050010 mounts_by_nodes = local_salt_client.cmd(tgt="L@"+','.join(nodes_in_group),
11 param="df -h | awk '{print $1}'",
Ievgeniia Zadorozhna45ae6b62019-03-05 18:52:44 +030012 expr_form='compound')
13
14 # Let's exclude cmp, kvm, ceph OSD nodes, mon, cid, k8s-ctl, k8s-cmp nodes
15 # These nodes will have different mounts and this is expected
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050016 exclude_nodes = local_salt_client.test_ping(
17 tgt="I@nova:compute or "
18 "I@ceph:osd or "
19 "I@salt:control or "
20 "I@prometheus:server and not I@influxdb:server or "
21 "I@kubernetes:* and not I@etcd:* or "
Hanna Arhipova80514de2019-04-25 12:33:28 +030022 "I@docker:host and not I@prometheus:server and not I@kubernetes:* or "
23 "I@gerrit:client and I@kubernetes:pool and not I@salt:master",
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050024 expr_form='compound').keys()
Ievgeniia Zadorozhna45ae6b62019-03-05 18:52:44 +030025
26 if len(mounts_by_nodes.keys()) < 2:
27 pytest.skip("Nothing to compare - only 1 node")
28
29 result = {}
30 pretty_result = {}
31
32 for node in mounts_by_nodes:
33 if node in exclude_nodes:
34 continue
35 result[node] = "\n".join(sorted(mounts_by_nodes[node].split()))
36 pretty_result[node] = sorted(mounts_by_nodes[node].split())
37
38 if not result:
39 pytest.skip("These nodes are skipped")
40
41 assert len(set(result.values())) == 1,\
42 "The nodes in the same group have different mounts:\n{}".format(
43 json.dumps(pretty_result, indent=4))