openstack-helm-infra/tools/gate/selenium/prometheusSelenium.py
Gage Hugo d14d826b26 Remove OSH Authors copyright
The current copyright refers to a non-existent group
"openstack helm authors" with often out-of-date references that
are confusing when adding a new file to the repo.

This change removes all references to this copyright by the
non-existent group and any blank lines underneath.

Change-Id: I1882738cf9757c5350a8533876fd37b5920b5235
2020-05-07 02:11:15 +00:00

67 lines
2.4 KiB
Python
Executable File

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
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.common.exceptions import TimeoutException
from seleniumtester import SeleniumTester
st = SeleniumTester('Prometheus')
username = st.get_variable('PROMETHEUS_USER')
password = st.get_variable('PROMETHEUS_PASSWORD')
prometheus_uri = st.get_variable('PROMETHEUS_URI')
prometheus_url = 'http://{}:{}@{}'.format(username, password, prometheus_uri)
try:
st.logger.info('Attempting to connect to Prometheus')
st.browser.get(prometheus_url)
el = WebDriverWait(st.browser, 15).until(
EC.title_contains('Prometheus')
)
st.logger.info('Connected to Prometheus')
st.take_screenshot('Prometheus Dashboard')
except TimeoutException:
st.logger.critical('Timed out waiting for Prometheus')
st.browser.quit()
sys.exit(1)
try:
st.logger.info('Attempting to view Runtime Information')
st.click_link_by_name('Status')
st.click_link_by_name('Runtime & Build Information')
el = WebDriverWait(st.browser, 15).until(
EC.presence_of_element_located((By.XPATH, '/html/body/div/table[1]'))
)
st.take_screenshot('Prometheus Runtime Info')
except TimeoutException:
st.logger.error('Failed to load Runtime Information page')
st.browser.quit()
sys.exit(1)
try:
st.logger.info('Attempting to view Runtime Information')
st.click_link_by_name('Status')
st.click_link_by_name('Command-Line Flags')
el = WebDriverWait(st.browser, 15).until(
EC.presence_of_element_located((By.XPATH, '/html/body/div/table'))
)
st.take_screenshot('Prometheus Command Line Flags')
except TimeoutException:
st.logger.error('Failed to load Command Line Flags page')
st.browser.quit()
sys.exit(1)
st.browser.quit()