Hanna Arhipova | 16e93fb | 2019-01-23 19:03:01 +0200 | [diff] [blame] | 1 | import utils |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 2 | import pytest |
| 3 | |
| 4 | |
| 5 | def test_ui_horizon(local_salt_client): |
| 6 | salt_output = local_salt_client.cmd( |
| 7 | 'horizon:server', |
| 8 | 'pillar.get', |
Oleksii Zhurba | e37cdab | 2017-11-02 20:00:03 +0000 | [diff] [blame] | 9 | ['_param:cluster_public_host'], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 10 | expr_form='pillar') |
mkraynov | e940404 | 2018-12-04 10:42:41 +0400 | [diff] [blame] | 11 | if not salt_output: |
| 12 | pytest.skip("Horizon is not enabled on this environment") |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 13 | 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 Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 26 | @pytest.mark.usefixtures('check_kibana') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 27 | def 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 Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 39 | @pytest.mark.usefixtures('check_prometheus') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 40 | def test_ui_prometheus(local_salt_client): |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 41 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 42 | result = local_salt_client.cmd( |
| 43 | 'keystone:server', |
| 44 | 'cmd.run', |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 45 | ['curl http://{}:15010/graph 2>&1 | \ |
| 46 | grep Prometheus'.format(IP)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 47 | 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 Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 52 | @pytest.mark.usefixtures('check_prometheus') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 53 | def test_ui_alert_manager(local_salt_client): |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 54 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 55 | result = local_salt_client.cmd( |
| 56 | 'keystone:server', |
| 57 | 'cmd.run', |
Oleksii Zhurba | b31323f | 2017-11-20 15:35:19 -0600 | [diff] [blame] | 58 | ['curl -s http://{}:15011/ | grep Alertmanager'.format(IP)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 59 | 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 Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 64 | @pytest.mark.usefixtures('check_grafana') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 65 | def test_ui_grafana(local_salt_client): |
Oleksii Zhurba | 370459e | 2018-09-11 15:54:51 -0500 | [diff] [blame] | 66 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 67 | 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 Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame^] | 74 | |
| 75 | |
| 76 | @pytest.mark.usefixtures('check_alerta') |
| 77 | def 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') |
| 93 | def 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) |