blob: 12ff05c90276e1868982bf26a22627b306ce6400 [file] [log] [blame]
Sergey Galkina56c20f2019-11-18 15:15:07 +04001import requests
Oleksii Zhurba020fab42017-11-01 20:13:28 +00002import pytest
3
4
Oleksii Zhurba23c18332019-05-09 18:53:40 -05005@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -06006@pytest.mark.usefixtures('check_openstack')
7def test_ui_horizon(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03008 IP = local_salt_client.pillar_get(
9 tgt='horizon:server',
10 param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050011 proto = local_salt_client.pillar_get(
12 param='_param:cluster_public_protocol')
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030013 if not IP:
mkraynove9404042018-12-04 10:42:41 +040014 pytest.skip("Horizon is not enabled on this environment")
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030015 result = local_salt_client.cmd_any(
16 tgt=ctl_nodes_pillar,
Oleksii Zhurba612ce7c2019-06-19 14:56:34 -050017 param='curl -k {0}://{1}/auth/login/ 2>&1 | \
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050018 grep Login'.format(proto, IP),
Oleksii Zhurba020fab42017-11-01 20:13:28 +000019 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 Zhurba23c18332019-05-09 18:53:40 -050024@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060025@pytest.mark.usefixtures('check_openstack')
26def test_public_openstack(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030027 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050028 proto = local_salt_client.pillar_get(
29 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060030 port = '5000'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050031 url = "{}://{}:{}/v3".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060032 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030033 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +020034 param='curl -k {}/ 2>&1 | grep stable'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060035 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 Zhurba2c2dc942019-01-31 16:35:57 -060040
41
Oleksii Zhurba23c18332019-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 Zhurba2c2dc942019-01-31 16:35:57 -060046def test_internal_ui_kibana(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030047 IP = local_salt_client.pillar_get(param='_param:stacklight_log_address')
Oleksii Zhurba7d4f07e2019-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"
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060052 port = '5601'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050053 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000054 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030055 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-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 Kruglovbc0a88b2019-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 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060062
63
Oleksii Zhurba23c18332019-05-09 18:53:40 -050064@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060065@pytest.mark.usefixtures('check_kibana')
66def test_public_ui_kibana(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030067 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050068 proto = local_salt_client.pillar_get(
69 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060070 port = '5601'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -050071 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060072 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030073 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +020074 param='curl -k {}/app/kibana 2>&1 | grep loading'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060075 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 Zhurba23c18332019-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 Zhurba2c2dc942019-01-31 16:35:57 -060086def test_internal_ui_prometheus(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030087 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -060088 protocol = 'http'
89 port = '15010'
90 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +000091 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030092 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-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 Kruglovbc0a88b2019-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 Zhurba23c18332019-05-09 18:53:40 -0500101@pytest.mark.smoke
Oleksii Zhurba8ce9fcf2018-10-05 18:38:22 +0300102@pytest.mark.usefixtures('check_prometheus')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600103def test_public_ui_prometheus(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300104 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Sergey Galkina56c20f2019-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 Zhurba7d4f07e2019-06-10 17:30:53 -0500109 proto = local_salt_client.pillar_get(
110 param='_param:cluster_public_protocol')
Sergey Galkina56c20f2019-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 Kruglovbc0a88b2019-08-20 11:45:35 +0200123 'Public Prometheus page is not reachable on {} from ctl '
124 'nodes'.format(url)
125 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600126
127
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500128@pytest.mark.sl_dup
129#stacklight-pytest?
130@pytest.mark.full
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600131@pytest.mark.usefixtures('check_prometheus')
132def test_internal_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300133 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600134 protocol = 'http'
135 port = '15011'
136 url = "{}://{}:{}".format(protocol, IP, port)
137 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300138 tgt=ctl_nodes_pillar,
139 param='curl -s {}/ | grep Alertmanager'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600140 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600145
146
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500147@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600148@pytest.mark.usefixtures('check_prometheus')
149def test_public_ui_alert_manager(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300150 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Sergey Galkina56c20f2019-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 Zhurba7d4f07e2019-06-10 17:30:53 -0500155 proto = local_salt_client.pillar_get(
156 param='_param:cluster_public_protocol')
Sergey Galkina56c20f2019-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 Kruglovbc0a88b2019-08-20 11:45:35 +0200169 'Public AlertManager page is not reachable on {} '
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600170 'from ctl nodes'.format(url)
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200171 )
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000172
173
Oleksii Zhurba23c18332019-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 Zhurba2c2dc942019-01-31 16:35:57 -0600178def test_internal_ui_grafana(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300179 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600180 protocol = 'http'
181 port = '15013'
182 url = "{}://{}:{}".format(protocol, IP, port)
Oleksii Zhurba020fab42017-11-01 20:13:28 +0000183 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300184 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 Kruglovbc0a88b2019-08-20 11:45:35 +0200187 assert len(result[result.keys()[0]]) != 0, (
188 'Internal Grafana page is not reachable on {} '
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600189 'from ctl nodes'.format(url)
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200190 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600191
192
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500193@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600194@pytest.mark.usefixtures('check_grafana')
195def test_public_ui_grafana(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300196 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500197 proto = local_salt_client.pillar_get(
198 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600199 port = '8084'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500200 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600201 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300202 tgt=ctl_nodes_pillar,
Oleksii Zhurba612ce7c2019-06-19 14:56:34 -0500203 param='curl -k {}/login 2>&1 | grep Grafana'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600204 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200205 assert len(result[result.keys()[0]]) != 0, (
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600206 'Public Grafana page is not reachable on {} from ctl nodes'.format(url)
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200207 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600208
209
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500210@pytest.mark.sl_dup
211#stacklight-pytest?
212@pytest.mark.full
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600213@pytest.mark.usefixtures('check_alerta')
214def test_internal_ui_alerta(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300215 IP = local_salt_client.pillar_get(param='_param:stacklight_monitor_address')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600216 protocol = 'http'
217 port = '15017'
218 url = "{}://{}:{}".format(protocol, IP, port)
219 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300220 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200221 param='curl {}/ 2>&1 | grep Alerta'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600222 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600227
228
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500229@pytest.mark.smoke
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600230@pytest.mark.usefixtures('check_alerta')
231def test_public_ui_alerta(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300232 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500233 proto = local_salt_client.pillar_get(
234 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600235 port = '15017'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500236 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600237 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300238 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200239 param='curl -k {}/ 2>&1 | grep Alerta'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600240 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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 Zhurba2c2dc942019-01-31 16:35:57 -0600243
244
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500245@pytest.mark.smoke
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300246@pytest.mark.usefixtures('check_openstack')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600247@pytest.mark.usefixtures('check_drivetrain')
248def test_public_ui_jenkins(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300249 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500250 proto = local_salt_client.pillar_get(
251 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600252 port = '8081'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500253 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600254 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300255 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200256 param='curl -k {}/ 2>&1 | grep Authentication'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600257 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200258 assert len(result[result.keys()[0]]) != 0, (
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600259 'Public Jenkins page is not reachable on {} from ctl nodes'.format(url)
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200260 )
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600261
262
Oleksii Zhurba23c18332019-05-09 18:53:40 -0500263@pytest.mark.smoke
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300264@pytest.mark.usefixtures('check_openstack')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600265@pytest.mark.usefixtures('check_drivetrain')
266def test_public_ui_gerrit(local_salt_client, ctl_nodes_pillar):
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300267 IP = local_salt_client.pillar_get(param='_param:cluster_public_host')
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500268 proto = local_salt_client.pillar_get(
269 param='_param:cluster_public_protocol')
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600270 port = '8070'
Oleksii Zhurba7d4f07e2019-06-10 17:30:53 -0500271 url = "{}://{}:{}".format(proto, IP, port)
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600272 result = local_salt_client.cmd(
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +0300273 tgt=ctl_nodes_pillar,
Dmitriy Kruglovbc0a88b2019-08-20 11:45:35 +0200274 param='curl -k {}/ 2>&1 | grep "Gerrit Code Review"'.format(url),
Oleksii Zhurba2c2dc942019-01-31 16:35:57 -0600275 expr_form='pillar')
Dmitriy Kruglovbc0a88b2019-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))