Additional Selenium tests for Kibana dashboard
This helps verify Kibana is working properly by using Selenium Webdriver to navigate to different index dashboards and takes screenshot of each one. It also add the scripts to the gates for single and multinode deployments. Change-Id: Ic2c91734d1eaac0ea4e7985bf69082942166715d
This commit is contained in:
parent
1c6d48f4a5
commit
9289cd0987
8
tools/deployment/common/kibana-selenium.sh
Executable file
8
tools/deployment/common/kibana-selenium.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export KIBANA_USER="admin"
|
||||||
|
export KIBANA_PASSWORD="changeme"
|
||||||
|
export KIBANA_LOGSTASH_URI="kibana.osh-infra.svc.cluster.local/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'logstash-*',interval:auto,query:(match_all:()),sort:!('@timestamp',desc))"
|
||||||
|
export KIBANA_KERNEL_URI="kibana.osh-infra.svc.cluster.local/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'kernel-*',interval:auto,query:(match_all:()),sort:!('@timestamp',desc))"
|
||||||
|
export KIBANA_JOURNAL_URI="kibana.osh-infra.svc.cluster.local/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'journal-*',interval:auto,query:(match_all:()),sort:!('@timestamp',desc))"
|
||||||
|
python tools/gate/selenium/kibanaSelenium.py
|
1
tools/deployment/multinode/kibana-selenium.sh
Symbolic link
1
tools/deployment/multinode/kibana-selenium.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../common/kibana-selenium.sh
|
1
tools/deployment/osh-infra-logging/kibana-selenium.sh
Symbolic link
1
tools/deployment/osh-infra-logging/kibana-selenium.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../common/kibana-selenium.sh
|
88
tools/gate/selenium/kibanaSelenium.py
Normal file
88
tools/gate/selenium/kibanaSelenium.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
from selenium.webdriver.chrome.options import Options
|
||||||
|
from selenium.common.exceptions import TimeoutException
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
logger = logging.getLogger('Kibana Selenium Tests')
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
ch = logging.StreamHandler()
|
||||||
|
ch.setLevel(logging.DEBUG)
|
||||||
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
ch.setFormatter(formatter)
|
||||||
|
logger.addHandler(ch)
|
||||||
|
|
||||||
|
# Get Grafana admin user name
|
||||||
|
if "KIBANA_USER" in os.environ:
|
||||||
|
kibana_user = os.environ['KIBANA_USER']
|
||||||
|
logger.info('Found Kibana username')
|
||||||
|
else:
|
||||||
|
logger.critical('Kibana username environment variable not set')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if "KIBANA_PASSWORD" in os.environ:
|
||||||
|
kibana_password = os.environ['KIBANA_PASSWORD']
|
||||||
|
logger.info('Found Kibana password')
|
||||||
|
else:
|
||||||
|
logger.critical('Kibana password environment variable not set')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if "KIBANA_JOURNAL_URI" in os.environ:
|
||||||
|
kibana_journal_uri = os.environ['KIBANA_JOURNAL_URI']
|
||||||
|
logger.info('Found Kibana Journal URI')
|
||||||
|
else:
|
||||||
|
logger.critical('Kibana Journal URI environment variable not set')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if "KIBANA_KERNEL_URI" in os.environ:
|
||||||
|
kibana_kernel_uri = os.environ['KIBANA_KERNEL_URI']
|
||||||
|
logger.info('Found Kibana Kernel URI')
|
||||||
|
else:
|
||||||
|
logger.critical('Kibana Kernel URI environment variable not set')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if "KIBANA_LOGSTASH_URI" in os.environ:
|
||||||
|
kibana_logstash_uri = os.environ['KIBANA_LOGSTASH_URI']
|
||||||
|
logger.info('Found Kibana Logstash URI')
|
||||||
|
else:
|
||||||
|
logger.critical('Kibana Logstash URI environment variable not set')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
options = Options()
|
||||||
|
options.add_argument('--headless')
|
||||||
|
options.add_argument('--no-sandbox')
|
||||||
|
options.add_argument('--window-size=1920x1080')
|
||||||
|
|
||||||
|
browser = webdriver.Chrome('/etc/selenium/chromedriver', chrome_options=options)
|
||||||
|
url = "http://{0}:{1}@{2}".format(kibana_user, kibana_password, kibana_journal_uri)
|
||||||
|
browser.get(url)
|
||||||
|
|
||||||
|
WebDriverWait(browser, 60).until(
|
||||||
|
EC.presence_of_element_located((By.XPATH, '//*[@id="kibana-body"]/div[1]/div/div/div[3]/discover-app/div/div[2]/div[2]/div/div[2]/div[2]/doc-table/div/table/tbody/tr[1]/td[2]'))
|
||||||
|
)
|
||||||
|
browser.save_screenshot('/tmp/artifacts/Kibana_JournalIndex.png')
|
||||||
|
|
||||||
|
browser = webdriver.Chrome('/etc/selenium/chromedriver', chrome_options=options)
|
||||||
|
url = "http://{0}:{1}@{2}".format(kibana_user, kibana_password, kibana_kernel_uri)
|
||||||
|
browser.get(url)
|
||||||
|
|
||||||
|
WebDriverWait(browser, 60).until(
|
||||||
|
EC.presence_of_element_located((By.XPATH, '//*[@id="kibana-body"]/div[1]/div/div/div[3]/discover-app/div/div[2]/div[2]/div/div[2]/div[2]/doc-table/div/table/tbody/tr[1]/td[2]'))
|
||||||
|
)
|
||||||
|
browser.save_screenshot('/tmp/artifacts/Kibana_KernelIndex.png')
|
||||||
|
|
||||||
|
browser = webdriver.Chrome('/etc/selenium/chromedriver', chrome_options=options)
|
||||||
|
url = "http://{0}:{1}@{2}".format(kibana_user, kibana_password, kibana_logstash_uri)
|
||||||
|
browser.get(url)
|
||||||
|
|
||||||
|
WebDriverWait(browser, 60).until(
|
||||||
|
EC.presence_of_element_located((By.XPATH, '//*[@id="kibana-body"]/div[1]/div/div/div[3]/discover-app/div/div[2]/div[2]/div/div[2]/div[2]/doc-table/div/table/tbody/tr[1]/td[2]'))
|
||||||
|
)
|
||||||
|
|
||||||
|
browser.save_screenshot('/tmp/artifacts/Kibana_LogstashIndex.png')
|
@ -65,6 +65,7 @@
|
|||||||
- ./tools/deployment/multinode/grafana-selenium.sh
|
- ./tools/deployment/multinode/grafana-selenium.sh
|
||||||
- ./tools/deployment/multinode/nagios-selenium.sh
|
- ./tools/deployment/multinode/nagios-selenium.sh
|
||||||
- ./tools/deployment/multinode/prometheus-selenium.sh
|
- ./tools/deployment/multinode/prometheus-selenium.sh
|
||||||
|
- ./tools/deployment/multinode/kibana-selenium.sh
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: openstack-helm-infra-tenant-ceph
|
name: openstack-helm-infra-tenant-ceph
|
||||||
@ -128,6 +129,7 @@
|
|||||||
- ./tools/deployment/osh-infra-logging/055-elasticsearch-ldap.sh
|
- ./tools/deployment/osh-infra-logging/055-elasticsearch-ldap.sh
|
||||||
- ./tools/deployment/osh-infra-logging/060-fluent-logging.sh
|
- ./tools/deployment/osh-infra-logging/060-fluent-logging.sh
|
||||||
- ./tools/deployment/osh-infra-logging/070-kibana.sh
|
- ./tools/deployment/osh-infra-logging/070-kibana.sh
|
||||||
|
- ./tools/deployment/osh-infra-logging/kibana-selenium.sh
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: openstack-helm-infra-aio-monitoring
|
name: openstack-helm-infra-aio-monitoring
|
||||||
|
Loading…
Reference in New Issue
Block a user