Added UI tests for Alerta: internal and public addresses
The related fix https://gerrit.mcp.mirantis.com/#/c/34661
adds tests for public endpoints for the rest of
StackLight UI.
Change-Id: Ie94ea242b19e30b7ed7143e01444125182fb6305
diff --git a/test_set/cvp-sanity/fixtures/base.py b/test_set/cvp-sanity/fixtures/base.py
index dccee56..60b8f28 100644
--- a/test_set/cvp-sanity/fixtures/base.py
+++ b/test_set/cvp-sanity/fixtures/base.py
@@ -27,6 +27,17 @@
@pytest.fixture(scope='session')
+def check_alerta(local_salt_client):
+ salt_output = local_salt_client.cmd(
+ 'prometheus:alerta',
+ 'test.ping',
+ expr_form='pillar')
+ if not salt_output:
+ pytest.skip("Alerta service or prometheus:alerta pillar \
+ are not found on this environment.")
+
+
+@pytest.fixture(scope='session')
def check_kibana(local_salt_client):
salt_output = local_salt_client.cmd(
'kibana:server',
diff --git a/test_set/cvp-sanity/tests/test_ui_addresses.py b/test_set/cvp-sanity/tests/test_ui_addresses.py
index 3f6f3a3..000bafe 100644
--- a/test_set/cvp-sanity/tests/test_ui_addresses.py
+++ b/test_set/cvp-sanity/tests/test_ui_addresses.py
@@ -71,3 +71,35 @@
expr_form='pillar')
assert len(result[result.keys()[0]]) != 0, \
'Grafana page is not reachable on {} from ctl nodes'.format(IP)
+
+
+@pytest.mark.usefixtures('check_alerta')
+def test_internal_ui_alerta(local_salt_client):
+ IP = utils.get_monitoring_ip('stacklight_monitor_address')
+ protocol = 'http'
+ port = '15017'
+ url = "{}://{}:{}".format(protocol, IP, port)
+ result = local_salt_client.cmd(
+ 'keystone:server',
+ 'cmd.run',
+ ['curl {}/ 2>&1 | \
+ grep Alerta'.format(url)],
+ expr_form='pillar')
+ assert len(result[result.keys()[0]]) != 0, \
+ 'Internal Alerta page is not reachable on {} from ctl nodes'.format(url)
+
+
+@pytest.mark.usefixtures('check_alerta')
+def test_public_ui_alerta(local_salt_client):
+ IP = utils.get_monitoring_ip('openstack_proxy_address')
+ protocol = 'https'
+ port = '15017'
+ url = "{}://{}:{}".format(protocol, IP, port)
+ result = local_salt_client.cmd(
+ 'keystone:server',
+ 'cmd.run',
+ ['curl {}/ 2>&1 | \
+ grep Alerta'.format(url)],
+ expr_form='pillar')
+ assert len(result[result.keys()[0]]) != 0, \
+ 'Public Alerta page is not reachable on {} from ctl nodes'.format(url)