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') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 27 | def test_internal_ui_kibana(local_salt_client): |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 28 | IP = utils.get_monitoring_ip('stacklight_log_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 29 | protocol = 'http' |
| 30 | port = '5601' |
| 31 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 32 | result = local_salt_client.cmd( |
| 33 | 'keystone:server', |
| 34 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 35 | ['curl {}/app/kibana 2>&1 | \ |
| 36 | grep loading'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 37 | expr_form='pillar') |
| 38 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 39 | 'Internal Kibana login page is not reachable on {} ' \ |
| 40 | 'from ctl nodes'.format(url) |
| 41 | |
| 42 | |
| 43 | @pytest.mark.usefixtures('check_kibana') |
| 44 | def test_public_ui_kibana(local_salt_client): |
| 45 | IP = utils.get_monitoring_ip('openstack_proxy_address') |
| 46 | protocol = 'https' |
| 47 | port = '5601' |
| 48 | url = "{}://{}:{}".format(protocol, IP, port) |
| 49 | result = local_salt_client.cmd( |
| 50 | 'keystone:server', |
| 51 | 'cmd.run', |
| 52 | ['curl {}/app/kibana 2>&1 | \ |
| 53 | grep loading'.format(url)], |
| 54 | expr_form='pillar') |
| 55 | assert len(result[result.keys()[0]]) != 0, \ |
| 56 | 'Public Kibana login page is not reachable on {} ' \ |
| 57 | 'from ctl nodes'.format(url) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 58 | |
| 59 | |
Oleksii Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 60 | @pytest.mark.usefixtures('check_prometheus') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 61 | def test_internal_ui_prometheus(local_salt_client): |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 62 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 63 | protocol = 'http' |
| 64 | port = '15010' |
| 65 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 66 | result = local_salt_client.cmd( |
| 67 | 'keystone:server', |
| 68 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 69 | ['curl {}/graph 2>&1 | \ |
| 70 | grep Prometheus'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 71 | expr_form='pillar') |
| 72 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 73 | 'Internal Prometheus page is not reachable on {} ' \ |
| 74 | 'from ctl nodes'.format(url) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 75 | |
| 76 | |
Oleksii Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 77 | @pytest.mark.usefixtures('check_prometheus') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 78 | def test_public_ui_prometheus(local_salt_client): |
| 79 | IP = utils.get_monitoring_ip('openstack_proxy_address') |
| 80 | protocol = 'https' |
| 81 | port = '15010' |
| 82 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 83 | result = local_salt_client.cmd( |
| 84 | 'keystone:server', |
| 85 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 86 | ['curl {}/graph 2>&1 | \ |
| 87 | grep Prometheus'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 88 | expr_form='pillar') |
| 89 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 90 | 'Public Prometheus page is not reachable on {} ' \ |
| 91 | 'from ctl nodes'.format(url) |
| 92 | |
| 93 | |
| 94 | @pytest.mark.usefixtures('check_prometheus') |
| 95 | def test_internal_ui_alert_manager(local_salt_client): |
| 96 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
| 97 | protocol = 'http' |
| 98 | port = '15011' |
| 99 | url = "{}://{}:{}".format(protocol, IP, port) |
| 100 | result = local_salt_client.cmd( |
| 101 | 'keystone:server', |
| 102 | 'cmd.run', |
| 103 | ['curl -s {}/ | grep Alertmanager'.format(url)], |
| 104 | expr_form='pillar') |
| 105 | assert len(result[result.keys()[0]]) != 0, \ |
| 106 | 'Internal AlertManager page is not reachable on {} ' \ |
| 107 | 'from ctl nodes'.format(url) |
| 108 | |
| 109 | |
| 110 | @pytest.mark.usefixtures('check_prometheus') |
| 111 | def test_public_ui_alert_manager(local_salt_client): |
| 112 | IP = utils.get_monitoring_ip('openstack_proxy_address') |
| 113 | protocol = 'https' |
| 114 | port = '15011' |
| 115 | url = "{}://{}:{}".format(protocol, IP, port) |
| 116 | result = local_salt_client.cmd( |
| 117 | 'keystone:server', |
| 118 | 'cmd.run', |
| 119 | ['curl -s {}/ | grep Alertmanager'.format(url)], |
| 120 | expr_form='pillar') |
| 121 | assert len(result[result.keys()[0]]) != 0, \ |
| 122 | 'Public AlertManager page is not reachable on {} ' \ |
| 123 | 'from ctl nodes'.format(url) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 124 | |
| 125 | |
Oleksii Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 126 | @pytest.mark.usefixtures('check_grafana') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 127 | def test_internal_ui_grafana(local_salt_client): |
Oleksii Zhurba | 370459e | 2018-09-11 15:54:51 -0500 | [diff] [blame] | 128 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 129 | protocol = 'http' |
| 130 | port = '15013' |
| 131 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 132 | result = local_salt_client.cmd( |
| 133 | 'keystone:server', |
| 134 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 135 | ['curl {}/login 2>&1 | grep Grafana'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 136 | expr_form='pillar') |
| 137 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 138 | 'Internal Grafana page is not reachable on {} ' \ |
| 139 | 'from ctl nodes'.format(url) |
| 140 | |
| 141 | |
| 142 | @pytest.mark.usefixtures('check_grafana') |
| 143 | def test_public_ui_grafana(local_salt_client): |
| 144 | IP = utils.get_monitoring_ip('openstack_proxy_address') |
| 145 | protocol = 'https' |
| 146 | port = '8084' |
| 147 | url = "{}://{}:{}".format(protocol, IP, port) |
| 148 | result = local_salt_client.cmd( |
| 149 | 'keystone:server', |
| 150 | 'cmd.run', |
| 151 | ['curl {}/login 2>&1 | grep Grafana'.format(url)], |
| 152 | expr_form='pillar') |
| 153 | assert len(result[result.keys()[0]]) != 0, \ |
| 154 | 'Public Grafana page is not reachable on {} from ctl nodes'.format(url) |
Ievgeniia Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 155 | |
| 156 | |
| 157 | @pytest.mark.usefixtures('check_alerta') |
| 158 | def test_internal_ui_alerta(local_salt_client): |
| 159 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
| 160 | protocol = 'http' |
| 161 | port = '15017' |
| 162 | url = "{}://{}:{}".format(protocol, IP, port) |
| 163 | result = local_salt_client.cmd( |
| 164 | 'keystone:server', |
| 165 | 'cmd.run', |
| 166 | ['curl {}/ 2>&1 | \ |
| 167 | grep Alerta'.format(url)], |
| 168 | expr_form='pillar') |
| 169 | assert len(result[result.keys()[0]]) != 0, \ |
| 170 | 'Internal Alerta page is not reachable on {} from ctl nodes'.format(url) |
| 171 | |
| 172 | |
| 173 | @pytest.mark.usefixtures('check_alerta') |
| 174 | def test_public_ui_alerta(local_salt_client): |
| 175 | IP = utils.get_monitoring_ip('openstack_proxy_address') |
| 176 | protocol = 'https' |
| 177 | port = '15017' |
| 178 | url = "{}://{}:{}".format(protocol, IP, port) |
| 179 | result = local_salt_client.cmd( |
| 180 | 'keystone:server', |
| 181 | 'cmd.run', |
| 182 | ['curl {}/ 2>&1 | \ |
| 183 | grep Alerta'.format(url)], |
| 184 | expr_form='pillar') |
| 185 | assert len(result[result.keys()[0]]) != 0, \ |
| 186 | 'Public Alerta page is not reachable on {} from ctl nodes'.format(url) |