blob: 12ff05c90276e1868982bf26a22627b306ce6400 [file] [log] [blame]
Sergey Galkinea5a9ae2019-11-18 15:15:07 +04001import requests
Oleksii Zhurba020fab42017-11-01 20:13:28 +00002import pytest
3
4
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -05005@pytest.mark.smoke
Oleksii Zhurba25215d92019-01-31 16:35:57 -06006@pytest.mark.usefixtures('check_openstack')
7def test_ui_horizon(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -05008 IP = local_salt_client.pillar_get(
9 tgt='horizon:server',
10 param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050011 proto = local_salt_client.pillar_get(
12 param='_param:cluster_public_protocol')
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050013 if not IP:
mkraynove9404042018-12-04 10:42:41 +040014 pytest.skip("Horizon is not enabled on this environment")
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050015 result = local_salt_client.cmd_any(
16 tgt=ctl_nodes_pillar,
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050017 param='curl -k {0}://{1}/auth/login/ 2>&1 | \
18 grep Login'.format(proto, IP),
Oleksii Zhurba020fab42017-11-01 20:13:28 +000019 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020020 assert len(result) != 0, (
21 'Horizon login page is not reachable on {} from ctl nodes.'.format(IP))
Oleksii Zhurba020fab42017-11-01 20:13:28 +000022
23
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -050024@pytest.mark.smoke
Oleksii Zhurba25215d92019-01-31 16:35:57 -060025@pytest.mark.usefixtures('check_openstack')
26def test_public_openstack(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050027 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050028 proto = local_salt_client.pillar_get(
29 param='_param:cluster_public_protocol')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060030 port = '5000'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050031 url = "{}://{}:{}/v3".format(proto, IP, port)
Oleksii Zhurba25215d92019-01-31 16:35:57 -060032 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050033 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020034 param='curl -k {}/ 2>&1 | grep stable'.format(url),
Oleksii Zhurba25215d92019-01-31 16:35:57 -060035 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020036 assert len(result[result.keys()[0]]) != 0, (
37 'Public Openstack url is not reachable on {} from ctl '
38 'nodes'.format(url)
39 )
Oleksii Zhurba25215d92019-01-31 16:35:57 -060040
41
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -050042@pytest.mark.sl_dup
43#stacklight-pytest?
44@pytest.mark.full
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030045@pytest.mark.usefixtures('check_kibana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060046def test_internal_ui_kibana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050047 IP = local_salt_client.pillar_get(param='_param:stacklight_log_address')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050048 ssl = local_salt_client.pillar_get(
49 tgt='kibana:server',
50 param='haproxy:proxy:listen:kibana:binds:ssl:enabled')
51 proto = "https" if ssl == "True" else "http"
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030052 port = '5601'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050053 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000054 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050055 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020056 param='curl -k {}/app/kibana 2>&1 | grep loading'.format(url),
Oleksii Zhurba020fab42017-11-01 20:13:28 +000057 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020058 assert len(result[result.keys()[0]]) != 0, (
59 'Internal Kibana login page is not reachable on {} from ctl '
60 'nodes'.format(url)
61 )
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030062
63
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -050064@pytest.mark.smoke
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030065@pytest.mark.usefixtures('check_kibana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060066def test_public_ui_kibana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050067 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050068 proto = local_salt_client.pillar_get(
69 param='_param:cluster_public_protocol')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030070 port = '5601'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -050071 url = "{}://{}:{}".format(proto, IP, port)
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030072 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050073 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020074 param='curl -k {}/app/kibana 2>&1 | grep loading'.format(url),
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030075 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020076 assert len(result[result.keys()[0]]) != 0, (
77 'Public Kibana login page is not reachable on {} from ctl '
78 'nodes'.format(url)
79 )
Oleksii Zhurba020fab42017-11-01 20:13:28 +000080
81
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -050082@pytest.mark.sl_dup
83#stacklight-pytest?
84@pytest.mark.full
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +030085@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -060086def test_internal_ui_prometheus(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050087 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +030088 protocol = 'http'
89 port = '15010'
90 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000091 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -050092 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020093 param='curl {}/graph 2>&1 | grep Prometheus'.format(url),
Oleksii Zhurba020fab42017-11-01 20:13:28 +000094 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +020095 assert len(result[result.keys()[0]]) != 0, (
96 'Internal Prometheus page is not reachable on {} from ctl '
97 'nodes'.format(url)
98 )
Oleksii Zhurba020fab42017-11-01 20:13:28 +000099
100
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500101@pytest.mark.smoke
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +0300102@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600103def test_public_ui_prometheus(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500104 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Sergey Galkinea5a9ae2019-11-18 15:15:07 +0400105 prometheus_password_old = local_salt_client.pillar_get(
106 param='_param:keepalived_prometheus_vip_password_generated')
107 prometheus_password = local_salt_client.pillar_get(
108 param='_param:prometheus_server_proxy_password_generated')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500109 proto = local_salt_client.pillar_get(
110 param='_param:cluster_public_protocol')
Sergey Galkinea5a9ae2019-11-18 15:15:07 +0400111 proxies = {"http": None, "https": None}
112 if prometheus_password == '':
113 prometheus_password = prometheus_password_old
114 response = requests.get(
115 '{0}://{1}:15010/graph'.format(proto, IP),
116 proxies=proxies,
117 auth=('prometheus', prometheus_password))
118 assert response.status_code == 200, (
119 'Issues with accessing public prometheus ui on {}:\n{}'.format(
120 IP, response.text)
121 )
122 assert response.content.find('Prometheus Time Series Collection') > -1, (
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200123 'Public Prometheus page is not reachable on {} from ctl '
124 'nodes'.format(url)
125 )
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300126
127
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500128@pytest.mark.sl_dup
129#stacklight-pytest?
130@pytest.mark.full
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300131@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600132def test_internal_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500133 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300134 protocol = 'http'
135 port = '15011'
136 url = "{}://{}:{}".format(protocol, IP, port)
137 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500138 tgt=ctl_nodes_pillar,
139 param='curl -s {}/ | grep Alertmanager'.format(url),
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300140 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200141 assert len(result[result.keys()[0]]) != 0, (
142 'Internal AlertManager page is not reachable on {} from ctl '
143 'nodes'.format(url)
144 )
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300145
146
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500147@pytest.mark.smoke
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300148@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600149def test_public_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500150 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Sergey Galkinea5a9ae2019-11-18 15:15:07 +0400151 alermanager_password_old = local_salt_client.pillar_get(
152 param='_param:keepalived_prometheus_vip_password_generated')
153 alermanager_password = local_salt_client.pillar_get(
154 param='_param:prometheus_alermanager_proxy_password_generated')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500155 proto = local_salt_client.pillar_get(
156 param='_param:cluster_public_protocol')
Sergey Galkinea5a9ae2019-11-18 15:15:07 +0400157 proxies = {"http": None, "https": None}
158 if alermanager_password == '':
159 alermanager_password = alermanager_password_old
160 response = requests.get(
161 '{0}://{1}:15011/'.format(proto, IP),
162 proxies=proxies,
163 auth=('alertmanager', alermanager_password))
164 assert response.status_code == 200, (
165 'Issues with accessing public alert manager ui on {}:\n{}'.format(
166 IP, response.text)
167 )
168 assert response.content.find('<title>Alertmanager</title>') > -1, (
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200169 'Public AlertManager page is not reachable on {} '
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300170 'from ctl nodes'.format(url)
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200171 )
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000172
173
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500174@pytest.mark.sl_dup
175#stacklight-pytest?
176@pytest.mark.full
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +0300177@pytest.mark.usefixtures('check_grafana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600178def test_internal_ui_grafana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500179 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300180 protocol = 'http'
181 port = '15013'
182 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000183 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500184 tgt=ctl_nodes_pillar,
185 param='curl {}/login 2>&1 | grep Grafana'.format(url),
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000186 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200187 assert len(result[result.keys()[0]]) != 0, (
188 'Internal Grafana page is not reachable on {} '
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300189 'from ctl nodes'.format(url)
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200190 )
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300191
192
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500193@pytest.mark.smoke
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300194@pytest.mark.usefixtures('check_grafana')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600195def test_public_ui_grafana(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500196 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500197 proto = local_salt_client.pillar_get(
198 param='_param:cluster_public_protocol')
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300199 port = '8084'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500200 url = "{}://{}:{}".format(proto, IP, port)
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300201 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500202 tgt=ctl_nodes_pillar,
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500203 param='curl -k {}/login 2>&1 | grep Grafana'.format(url),
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300204 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200205 assert len(result[result.keys()[0]]) != 0, (
Ievgeniia Zadorozhna09b1ae82019-01-28 13:06:01 +0300206 'Public Grafana page is not reachable on {} from ctl nodes'.format(url)
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200207 )
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300208
209
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500210@pytest.mark.sl_dup
211#stacklight-pytest?
212@pytest.mark.full
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300213@pytest.mark.usefixtures('check_alerta')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600214def test_internal_ui_alerta(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500215 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300216 protocol = 'http'
217 port = '15017'
218 url = "{}://{}:{}".format(protocol, IP, port)
219 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500220 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200221 param='curl {}/ 2>&1 | grep Alerta'.format(url),
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300222 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200223 assert len(result[result.keys()[0]]) != 0, (
224 'Internal Alerta page is not reachable on {} from '
225 'ctl nodes'.format(url)
226 )
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300227
228
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500229@pytest.mark.smoke
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300230@pytest.mark.usefixtures('check_alerta')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600231def test_public_ui_alerta(local_salt_client, ctl_nodes_pillar):
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500232 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500233 proto = local_salt_client.pillar_get(
234 param='_param:cluster_public_protocol')
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300235 port = '15017'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500236 url = "{}://{}:{}".format(proto, IP, port)
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300237 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500238 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200239 param='curl -k {}/ 2>&1 | grep Alerta'.format(url),
Ievgeniia Zadorozhnadf243ef2018-11-08 18:17:17 +0300240 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200241 assert len(result[result.keys()[0]]) != 0, (
242 'Public Alerta page is not reachable on {} from ctl nodes'.format(url))
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600243
244
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500245@pytest.mark.smoke
Oleksii Zhurbabcb27cd2019-04-23 17:04:20 -0500246@pytest.mark.usefixtures('check_openstack')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600247@pytest.mark.usefixtures('check_drivetrain')
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500248def test_public_ui_jenkins(local_salt_client, ctl_nodes_pillar):
249 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500250 proto = local_salt_client.pillar_get(
251 param='_param:cluster_public_protocol')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600252 port = '8081'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500253 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600254 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500255 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200256 param='curl -k {}/ 2>&1 | grep Authentication'.format(url),
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600257 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200258 assert len(result[result.keys()[0]]) != 0, (
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600259 'Public Jenkins page is not reachable on {} from ctl nodes'.format(url)
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200260 )
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600261
262
Oleksii Zhurba5b15b9b2019-05-09 18:53:40 -0500263@pytest.mark.smoke
Oleksii Zhurbabcb27cd2019-04-23 17:04:20 -0500264@pytest.mark.usefixtures('check_openstack')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600265@pytest.mark.usefixtures('check_drivetrain')
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500266def test_public_ui_gerrit(local_salt_client, ctl_nodes_pillar):
267 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500268 proto = local_salt_client.pillar_get(
269 param='_param:cluster_public_protocol')
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600270 port = '8070'
Oleksii Zhurba85f55fe2019-06-10 17:30:53 -0500271 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600272 result = local_salt_client.cmd(
Oleksii Zhurba4bfd2ee2019-04-10 21:56:58 -0500273 tgt=ctl_nodes_pillar,
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200274 param='curl -k {}/ 2>&1 | grep "Gerrit Code Review"'.format(url),
Oleksii Zhurba25215d92019-01-31 16:35:57 -0600275 expr_form='pillar')
Dmitriy Kruglova34a3042019-08-20 11:45:35 +0200276 assert len(result[result.keys()[0]]) != 0, (
277 'Public Gerrit page is not reachable on {} from ctl nodes'.format(url))