blob: a2f0f2da74aa043bdc99c68d6c52bb036a3326a5 [file] [log] [blame]
Hanna Arhipova16e93fb2019-01-23 19:03:01 +02001import utils
Oleksii Zhurba020fab42017-11-01 20:13:28 +00002import pytest
3
4
Oleksii Zhurba25215d92019-01-31 16:35:57 -06005@pytest.mark.usefixtures('check_openstack')
6def test_ui_horizon(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba020fab42017-11-01 20:13:28 +00007 salt_output = local_salt_client.cmd(
8 'horizon:server',
9 'pillar.get',
Oleksii Zhurbae37cdab2017-11-02 20:00:03 +000010 ['_param:cluster_public_host'],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000011 expr_form='pillar')
mkraynove9404042018-12-04 10:42:41 +040012 if not salt_output:
13 pytest.skip("Horizon is not enabled on this environment")
Oleksii Zhurba020fab42017-11-01 20:13:28 +000014 IP = [salt_output[node] for node in salt_output
15 if salt_output[node]]
16 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -060017 ctl_nodes_pillar,
Oleksii Zhurba020fab42017-11-01 20:13:28 +000018 'cmd.run',
19 ['curl --insecure https://{}/auth/login/ 2>&1 | \
20 grep Login'.format(IP[0])],
21 expr_form='pillar')
22 assert len(result[result.keys()[0]]) != 0, \
23 'Horizon login page is not reachable on {} from ctl nodes'.format(
24 IP[0])
25
26
Oleksii Zhurba25215d92019-01-31 16:35:57 -060027@pytest.mark.usefixtures('check_openstack')
28def test_public_openstack(local_salt_client, ctl_nodes_pillar):
29 IP = utils.get_monitoring_ip('cluster_public_host')
30 protocol = 'https'
31 port = '5000'
32 url = "{}://{}:{}/v3".format(protocol, IP, port)
33 result = local_salt_client.cmd(
34 ctl_nodes_pillar,
35 'cmd.run',
36 ['curl -k {}/ 2>&1 | \
37 grep stable'.format(url)],
38 expr_form='pillar')
39 assert len(result[result.keys()[0]]) != 0, \
40 'Public Openstack url is not reachable on {} from ctl nodes'.format(url)
41
42
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030043@pytest.mark.usefixtures('check_kibana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060044def test_internal_ui_kibana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba020fab42017-11-01 20:13:28 +000045 IP = utils.get_monitoring_ip('stacklight_log_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030046 protocol = 'http'
47 port = '5601'
48 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000049 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -060050 ctl_nodes_pillar,
Oleksii Zhurba020fab42017-11-01 20:13:28 +000051 'cmd.run',
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030052 ['curl {}/app/kibana 2>&1 | \
53 grep loading'.format(url)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000054 expr_form='pillar')
55 assert len(result[result.keys()[0]]) != 0, \
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030056 'Internal Kibana login page is not reachable on {} ' \
57 'from ctl nodes'.format(url)
58
59
60@pytest.mark.usefixtures('check_kibana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060061def test_public_ui_kibana(local_salt_client, ctl_nodes_pillar):
62 IP = utils.get_monitoring_ip('cluster_public_host')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030063 protocol = 'https'
64 port = '5601'
65 url = "{}://{}:{}".format(protocol, IP, port)
66 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -060067 ctl_nodes_pillar,
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030068 'cmd.run',
69 ['curl {}/app/kibana 2>&1 | \
70 grep loading'.format(url)],
71 expr_form='pillar')
72 assert len(result[result.keys()[0]]) != 0, \
73 'Public Kibana login page is not reachable on {} ' \
74 'from ctl nodes'.format(url)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000075
76
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030077@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060078def test_internal_ui_prometheus(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurbae592ed12018-06-21 18:01:09 -050079 IP = utils.get_monitoring_ip('stacklight_monitor_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030080 protocol = 'http'
81 port = '15010'
82 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000083 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -060084 ctl_nodes_pillar,
Oleksii Zhurba020fab42017-11-01 20:13:28 +000085 'cmd.run',
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030086 ['curl {}/graph 2>&1 | \
87 grep Prometheus'.format(url)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +000088 expr_form='pillar')
89 assert len(result[result.keys()[0]]) != 0, \
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030090 'Internal Prometheus page is not reachable on {} ' \
91 'from ctl nodes'.format(url)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000092
93
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030094@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060095def test_public_ui_prometheus(local_salt_client, ctl_nodes_pillar):
96 IP = utils.get_monitoring_ip('cluster_public_host')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030097 protocol = 'https'
98 port = '15010'
99 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000100 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600101 ctl_nodes_pillar,
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000102 'cmd.run',
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300103 ['curl {}/graph 2>&1 | \
104 grep Prometheus'.format(url)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000105 expr_form='pillar')
106 assert len(result[result.keys()[0]]) != 0, \
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300107 'Public Prometheus page is not reachable on {} ' \
108 'from ctl nodes'.format(url)
109
110
111@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600112def test_internal_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300113 IP = utils.get_monitoring_ip('stacklight_monitor_address')
114 protocol = 'http'
115 port = '15011'
116 url = "{}://{}:{}".format(protocol, IP, port)
117 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600118 ctl_nodes_pillar,
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300119 'cmd.run',
120 ['curl -s {}/ | grep Alertmanager'.format(url)],
121 expr_form='pillar')
122 assert len(result[result.keys()[0]]) != 0, \
123 'Internal AlertManager page is not reachable on {} ' \
124 'from ctl nodes'.format(url)
125
126
127@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600128def test_public_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
129 IP = utils.get_monitoring_ip('cluster_public_host')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300130 protocol = 'https'
131 port = '15011'
132 url = "{}://{}:{}".format(protocol, IP, port)
133 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600134 ctl_nodes_pillar,
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300135 'cmd.run',
136 ['curl -s {}/ | grep Alertmanager'.format(url)],
137 expr_form='pillar')
138 assert len(result[result.keys()[0]]) != 0, \
139 'Public AlertManager page is not reachable on {} ' \
140 'from ctl nodes'.format(url)
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000141
142
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +0300143@pytest.mark.usefixtures('check_grafana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600144def test_internal_ui_grafana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba370459e2018-09-11 15:54:51 -0500145 IP = utils.get_monitoring_ip('stacklight_monitor_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300146 protocol = 'http'
147 port = '15013'
148 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000149 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600150 ctl_nodes_pillar,
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000151 'cmd.run',
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300152 ['curl {}/login 2>&1 | grep Grafana'.format(url)],
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000153 expr_form='pillar')
154 assert len(result[result.keys()[0]]) != 0, \
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300155 'Internal Grafana page is not reachable on {} ' \
156 'from ctl nodes'.format(url)
157
158
159@pytest.mark.usefixtures('check_grafana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600160def test_public_ui_grafana(local_salt_client, ctl_nodes_pillar):
161 IP = utils.get_monitoring_ip('cluster_public_host')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300162 protocol = 'https'
163 port = '8084'
164 url = "{}://{}:{}".format(protocol, IP, port)
165 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600166 ctl_nodes_pillar,
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300167 'cmd.run',
168 ['curl {}/login 2>&1 | grep Grafana'.format(url)],
169 expr_form='pillar')
170 assert len(result[result.keys()[0]]) != 0, \
171 'Public Grafana page is not reachable on {} from ctl nodes'.format(url)
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300172
173
174@pytest.mark.usefixtures('check_alerta')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600175def test_internal_ui_alerta(local_salt_client, ctl_nodes_pillar):
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300176 IP = utils.get_monitoring_ip('stacklight_monitor_address')
177 protocol = 'http'
178 port = '15017'
179 url = "{}://{}:{}".format(protocol, IP, port)
180 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600181 ctl_nodes_pillar,
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300182 'cmd.run',
183 ['curl {}/ 2>&1 | \
184 grep Alerta'.format(url)],
185 expr_form='pillar')
186 assert len(result[result.keys()[0]]) != 0, \
187 'Internal Alerta page is not reachable on {} from ctl nodes'.format(url)
188
189
190@pytest.mark.usefixtures('check_alerta')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600191def test_public_ui_alerta(local_salt_client, ctl_nodes_pillar):
192 IP = utils.get_monitoring_ip('cluster_public_host')
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300193 protocol = 'https'
194 port = '15017'
195 url = "{}://{}:{}".format(protocol, IP, port)
196 result = local_salt_client.cmd(
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600197 ctl_nodes_pillar,
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300198 'cmd.run',
199 ['curl {}/ 2>&1 | \
200 grep Alerta'.format(url)],
201 expr_form='pillar')
202 assert len(result[result.keys()[0]]) != 0, \
203 'Public Alerta page is not reachable on {} from ctl nodes'.format(url)
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600204
205
206@pytest.mark.usefixtures('check_drivetrain')
207def test_public_ui_jenkins(local_salt_client, ctl_nodes_pillar):
208 IP = utils.get_monitoring_ip('cluster_public_host')
209 protocol = 'https'
210 port = '8081'
211 url = "{}://{}:{}".format(protocol, IP, port)
212 result = local_salt_client.cmd(
213 ctl_nodes_pillar,
214 'cmd.run',
215 ['curl -k {}/ 2>&1 | \
216 grep Authentication'.format(url)],
217 expr_form='pillar')
218 assert len(result[result.keys()[0]]) != 0, \
219 'Public Jenkins page is not reachable on {} from ctl nodes'.format(url)
220
221
222@pytest.mark.usefixtures('check_drivetrain')
223def test_public_ui_gerrit(local_salt_client, ctl_nodes_pillar):
224 IP = utils.get_monitoring_ip('cluster_public_host')
225 protocol = 'https'
226 port = '8070'
227 url = "{}://{}:{}".format(protocol, IP, port)
228 result = local_salt_client.cmd(
229 ctl_nodes_pillar,
230 'cmd.run',
231 ['curl -k {}/ 2>&1 | \
232 grep "Gerrit Code Review"'.format(url)],
233 expr_form='pillar')
234 assert len(result[result.keys()[0]]) != 0, \
235 'Public Gerrit page is not reachable on {} from ctl nodes'.format(url)