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 | |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 5 | @pytest.mark.usefixtures('check_openstack') |
| 6 | def test_ui_horizon(local_salt_client, ctl_nodes_pillar): |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 7 | salt_output = local_salt_client.cmd( |
| 8 | 'horizon:server', |
| 9 | 'pillar.get', |
Oleksii Zhurba | e37cdab | 2017-11-02 20:00:03 +0000 | [diff] [blame] | 10 | ['_param:cluster_public_host'], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 11 | expr_form='pillar') |
mkraynov | e940404 | 2018-12-04 10:42:41 +0400 | [diff] [blame] | 12 | if not salt_output: |
| 13 | pytest.skip("Horizon is not enabled on this environment") |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 14 | IP = [salt_output[node] for node in salt_output |
| 15 | if salt_output[node]] |
| 16 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 17 | ctl_nodes_pillar, |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 18 | '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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 27 | @pytest.mark.usefixtures('check_openstack') |
| 28 | def 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 Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 43 | @pytest.mark.usefixtures('check_kibana') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 44 | def test_internal_ui_kibana(local_salt_client, ctl_nodes_pillar): |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 45 | IP = utils.get_monitoring_ip('stacklight_log_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 46 | protocol = 'http' |
| 47 | port = '5601' |
| 48 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 49 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 50 | ctl_nodes_pillar, |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 51 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 52 | ['curl {}/app/kibana 2>&1 | \ |
| 53 | grep loading'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 54 | expr_form='pillar') |
| 55 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 56 | 'Internal Kibana login page is not reachable on {} ' \ |
| 57 | 'from ctl nodes'.format(url) |
| 58 | |
| 59 | |
| 60 | @pytest.mark.usefixtures('check_kibana') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 61 | def test_public_ui_kibana(local_salt_client, ctl_nodes_pillar): |
| 62 | IP = utils.get_monitoring_ip('cluster_public_host') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 63 | protocol = 'https' |
| 64 | port = '5601' |
| 65 | url = "{}://{}:{}".format(protocol, IP, port) |
| 66 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 67 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 68 | '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 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') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 78 | def test_internal_ui_prometheus(local_salt_client, ctl_nodes_pillar): |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 79 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 80 | protocol = 'http' |
| 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( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 84 | ctl_nodes_pillar, |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 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 | 'Internal Prometheus page is not reachable on {} ' \ |
| 91 | 'from ctl nodes'.format(url) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 92 | |
| 93 | |
Oleksii Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 94 | @pytest.mark.usefixtures('check_prometheus') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 95 | def test_public_ui_prometheus(local_salt_client, ctl_nodes_pillar): |
| 96 | IP = utils.get_monitoring_ip('cluster_public_host') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 97 | protocol = 'https' |
| 98 | port = '15010' |
| 99 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 100 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 101 | ctl_nodes_pillar, |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 102 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 103 | ['curl {}/graph 2>&1 | \ |
| 104 | grep Prometheus'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 105 | expr_form='pillar') |
| 106 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 107 | 'Public Prometheus page is not reachable on {} ' \ |
| 108 | 'from ctl nodes'.format(url) |
| 109 | |
| 110 | |
| 111 | @pytest.mark.usefixtures('check_prometheus') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 112 | def test_internal_ui_alert_manager(local_salt_client, ctl_nodes_pillar): |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 113 | 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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 118 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 119 | '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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 128 | def test_public_ui_alert_manager(local_salt_client, ctl_nodes_pillar): |
| 129 | IP = utils.get_monitoring_ip('cluster_public_host') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 130 | protocol = 'https' |
| 131 | port = '15011' |
| 132 | url = "{}://{}:{}".format(protocol, IP, port) |
| 133 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 134 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 135 | '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 Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 141 | |
| 142 | |
Oleksii Zhurba | 8ce9fcf | 2018-10-05 18:38:22 +0300 | [diff] [blame] | 143 | @pytest.mark.usefixtures('check_grafana') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 144 | def test_internal_ui_grafana(local_salt_client, ctl_nodes_pillar): |
Oleksii Zhurba | 370459e | 2018-09-11 15:54:51 -0500 | [diff] [blame] | 145 | IP = utils.get_monitoring_ip('stacklight_monitor_address') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 146 | protocol = 'http' |
| 147 | port = '15013' |
| 148 | url = "{}://{}:{}".format(protocol, IP, port) |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 149 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 150 | ctl_nodes_pillar, |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 151 | 'cmd.run', |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 152 | ['curl {}/login 2>&1 | grep Grafana'.format(url)], |
Oleksii Zhurba | 020fab4 | 2017-11-01 20:13:28 +0000 | [diff] [blame] | 153 | expr_form='pillar') |
| 154 | assert len(result[result.keys()[0]]) != 0, \ |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 155 | 'Internal Grafana page is not reachable on {} ' \ |
| 156 | 'from ctl nodes'.format(url) |
| 157 | |
| 158 | |
| 159 | @pytest.mark.usefixtures('check_grafana') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 160 | def test_public_ui_grafana(local_salt_client, ctl_nodes_pillar): |
| 161 | IP = utils.get_monitoring_ip('cluster_public_host') |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 162 | protocol = 'https' |
| 163 | port = '8084' |
| 164 | url = "{}://{}:{}".format(protocol, IP, port) |
| 165 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 166 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | 09b1ae8 | 2019-01-28 13:06:01 +0300 | [diff] [blame] | 167 | '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 Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 172 | |
| 173 | |
| 174 | @pytest.mark.usefixtures('check_alerta') |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 175 | def test_internal_ui_alerta(local_salt_client, ctl_nodes_pillar): |
Ievgeniia Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 176 | 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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 181 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 182 | '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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 191 | def test_public_ui_alerta(local_salt_client, ctl_nodes_pillar): |
| 192 | IP = utils.get_monitoring_ip('cluster_public_host') |
Ievgeniia Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 193 | protocol = 'https' |
| 194 | port = '15017' |
| 195 | url = "{}://{}:{}".format(protocol, IP, port) |
| 196 | result = local_salt_client.cmd( |
Oleksii Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 197 | ctl_nodes_pillar, |
Ievgeniia Zadorozhna | df243ef | 2018-11-08 18:17:17 +0300 | [diff] [blame] | 198 | '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 Zhurba | 25215d9 | 2019-01-31 16:35:57 -0600 | [diff] [blame^] | 204 | |
| 205 | |
| 206 | @pytest.mark.usefixtures('check_drivetrain') |
| 207 | def 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') |
| 223 | def 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) |