blob: 000bafe6faf70dbb882f7845265e8bdc31c2d1ee [file] [log] [blame]
Hanna Arhipova16e93fb2019-01-23 19:03:01 +02001import utils
Oleksii Zhurba020fab42017-11-01 20:13:28 +00002import pytest
3
4
5def test_ui_horizon(local_salt_client):
6 salt_output = local_salt_client.cmd(
7 'horizon:server',
8 'pillar.get',
Oleksii Zhurbae37cdab2017-11-02 20:00:03 +00009 ['_param:cluster_public_host'],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000010 expr_form='pillar')
mkraynove9404042018-12-04 10:42:41 +040011 if not salt_output:
12 pytest.skip("Horizon is not enabled on this environment")
Oleksii Zhurba020fab42017-11-01 20:13:28 +000013 IP = [salt_output[node] for node in salt_output
14 if salt_output[node]]
15 result = local_salt_client.cmd(
16 'keystone:server',
17 'cmd.run',
18 ['curl --insecure https://{}/auth/login/ 2>&1 | \
19 grep Login'.format(IP[0])],
20 expr_form='pillar')
21 assert len(result[result.keys()[0]]) != 0, \
22 'Horizon login page is not reachable on {} from ctl nodes'.format(
23 IP[0])
24
25
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030026@pytest.mark.usefixtures('check_kibana')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000027def test_ui_kibana(local_salt_client):
28 IP = utils.get_monitoring_ip('stacklight_log_address')
29 result = local_salt_client.cmd(
30 'keystone:server',
31 'cmd.run',
32 ['curl http://{}:5601/app/kibana 2>&1 | \
33 grep loading'.format(IP)],
34 expr_form='pillar')
35 assert len(result[result.keys()[0]]) != 0, \
36 'Kibana login page is not reachable on {} from ctl nodes'.format(IP)
37
38
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030039@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000040def test_ui_prometheus(local_salt_client):
Oleksii Zhurbae592ed12018-06-21 18:01:09 -050041 IP = utils.get_monitoring_ip('stacklight_monitor_address')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000042 result = local_salt_client.cmd(
43 'keystone:server',
44 'cmd.run',
Oleksii Zhurbae592ed12018-06-21 18:01:09 -050045 ['curl http://{}:15010/graph 2>&1 | \
46 grep Prometheus'.format(IP)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000047 expr_form='pillar')
48 assert len(result[result.keys()[0]]) != 0, \
49 'Prometheus page is not reachable on {} from ctl nodes'.format(IP)
50
51
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030052@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000053def test_ui_alert_manager(local_salt_client):
Oleksii Zhurbae592ed12018-06-21 18:01:09 -050054 IP = utils.get_monitoring_ip('stacklight_monitor_address')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000055 result = local_salt_client.cmd(
56 'keystone:server',
57 'cmd.run',
Oleksii Zhurbab31323f2017-11-20 15:35:19 -060058 ['curl -s http://{}:15011/ | grep Alertmanager'.format(IP)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000059 expr_form='pillar')
60 assert len(result[result.keys()[0]]) != 0, \
61 'AlertManager page is not reachable on {} from ctl nodes'.format(IP)
62
63
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030064@pytest.mark.usefixtures('check_grafana')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000065def test_ui_grafana(local_salt_client):
Oleksii Zhurba370459e2018-09-11 15:54:51 -050066 IP = utils.get_monitoring_ip('stacklight_monitor_address')
Oleksii Zhurba020fab42017-11-01 20:13:28 +000067 result = local_salt_client.cmd(
68 'keystone:server',
69 'cmd.run',
70 ['curl http://{}:15013/login 2>&1 | grep Grafana'.format(IP)],
71 expr_form='pillar')
72 assert len(result[result.keys()[0]]) != 0, \
73 'Grafana page is not reachable on {} from ctl nodes'.format(IP)
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +030074
75
76@pytest.mark.usefixtures('check_alerta')
77def test_internal_ui_alerta(local_salt_client):
78 IP = utils.get_monitoring_ip('stacklight_monitor_address')
79 protocol = 'http'
80 port = '15017'
81 url = "{}://{}:{}".format(protocol, IP, port)
82 result = local_salt_client.cmd(
83 'keystone:server',
84 'cmd.run',
85 ['curl {}/ 2>&1 | \
86 grep Alerta'.format(url)],
87 expr_form='pillar')
88 assert len(result[result.keys()[0]]) != 0, \
89 'Internal Alerta page is not reachable on {} from ctl nodes'.format(url)
90
91
92@pytest.mark.usefixtures('check_alerta')
93def test_public_ui_alerta(local_salt_client):
94 IP = utils.get_monitoring_ip('openstack_proxy_address')
95 protocol = 'https'
96 port = '15017'
97 url = "{}://{}:{}".format(protocol, IP, port)
98 result = local_salt_client.cmd(
99 'keystone:server',
100 'cmd.run',
101 ['curl {}/ 2>&1 | \
102 grep Alerta'.format(url)],
103 expr_form='pillar')
104 assert len(result[result.keys()[0]]) != 0, \
105 'Public Alerta page is not reachable on {} from ctl nodes'.format(url)