Skip to content

Commit b81d910

Browse files
committed
Add OpenSearch Dashboards test
1 parent 7d3fe42 commit b81d910

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
opensearch-py==2.5.*
22
prometheus-api-client==0.5.*
33
pytest-testinfra==10.1.*
4+
requests==2.31.*

stackhpc_openstack_tests/monitoring/test_opensearch.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
# under the License.
1414

1515
# TODO:
16-
# * Dashboard login
1716
# * Cluster health
1817

1918
from opensearchpy import OpenSearch
2019
import os
2120
import pytest
21+
import requests
2222

2323
from stackhpc_openstack_tests import utils
2424

@@ -60,3 +60,15 @@ def test_opensearch_has_info_logs(opensearch):
6060
# https://opensearch-project.github.io/opensearch-py/api-ref/clients/opensearch_client.html#opensearchpy.OpenSearch.search
6161
result = opensearch.search(body=query, index="flog-*", size=1)
6262
assert len(result["hits"]["hits"]) == 1
63+
64+
65+
def test_opensearch_dashboards_status():
66+
"""Check that OpenSearch Dashboards is accessible and is in a green state."""
67+
dashboard_url = os.environ["OPENSEARCH_DASHBOARDS_URL"]
68+
dashboard_username = os.environ["OPENSEARCH_DASHBOARDS_USERNAME"]
69+
dashboard_password = os.environ["OPENSEARCH_DASHBOARDS_PASSWORD"]
70+
dashboard_url += "/api/status"
71+
result = requests.get(dashboard_url, auth=(dashboard_username, dashboard_password))
72+
assert result.ok
73+
result = result.json()
74+
assert result["status"]["overall"]["state"] == "green"

0 commit comments

Comments
 (0)