From 0e66ef972ac6e6e3198dd31432232b95d5b8159e Mon Sep 17 00:00:00 2001 From: Meghan Date: Thu, 14 Jan 2021 08:13:08 -0800 Subject: [PATCH] Update Grafana version This brings the Grafana version up to the current version and fixes the selenium helm and gate test for the new login dashboard. Change-Id: I0b65412f4689c763b3f035055ecbb4ca63c21048 --- grafana/Chart.yaml | 4 +- grafana/templates/bin/_selenium-tests.py.tpl | 7 +-- grafana/values.yaml | 2 +- tools/gate/selenium/grafanaSelenium.py | 54 +++----------------- 4 files changed, 13 insertions(+), 54 deletions(-) diff --git a/grafana/Chart.yaml b/grafana/Chart.yaml index 42de1e7d6..3789fb0c7 100644 --- a/grafana/Chart.yaml +++ b/grafana/Chart.yaml @@ -12,10 +12,10 @@ --- apiVersion: v1 -appVersion: v6.2.0 +appVersion: v7.3.6 description: OpenStack-Helm Grafana name: grafana -version: 0.1.1 +version: 0.1.2 home: https://grafana.com/ sources: - https://github.com/grafana/grafana diff --git a/grafana/templates/bin/_selenium-tests.py.tpl b/grafana/templates/bin/_selenium-tests.py.tpl index 180c7156e..550963846 100644 --- a/grafana/templates/bin/_selenium-tests.py.tpl +++ b/grafana/templates/bin/_selenium-tests.py.tpl @@ -71,12 +71,9 @@ except TimeoutException: logger.info("Attempting to log into Grafana dashboard") try: - browser.find_element_by_name('username').send_keys(username) + browser.find_element_by_name('user').send_keys(username) browser.find_element_by_name('password').send_keys(password) - browser.find_element_by_css_selector( - 'body > grafana-app > div.main-view > div > div:nth-child(1) > div > ' - 'div > div.login-outer-box > div.login-inner-box > form > div.login-button-group > button' - ).click() + browser.find_element_by_class_name('css-6ntnx5-button').click() logger.info("Successfully logged in to Grafana") except NoSuchElementException: logger.error("Failed to log in to Grafana") diff --git a/grafana/values.yaml b/grafana/values.yaml index d60afbc35..ad5055d77 100644 --- a/grafana/values.yaml +++ b/grafana/values.yaml @@ -17,7 +17,7 @@ --- images: tags: - grafana: docker.io/grafana/grafana:6.2.0 + grafana: docker.io/grafana/grafana:7.3.6 dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 db_init: docker.io/openstackhelm/heat:stein-ubuntu_bionic grafana_db_session_sync: docker.io/openstackhelm/heat:stein-ubuntu_bionic diff --git a/tools/gate/selenium/grafanaSelenium.py b/tools/gate/selenium/grafanaSelenium.py index fade39531..2af409327 100755 --- a/tools/gate/selenium/grafanaSelenium.py +++ b/tools/gate/selenium/grafanaSelenium.py @@ -23,11 +23,10 @@ st = SeleniumTester('Grafana') username = st.get_variable('GRAFANA_USER') password = st.get_variable('GRAFANA_PASSWORD') grafana_uri = st.get_variable('GRAFANA_URI') -grafana_url = 'http://{}'.format(grafana_uri) try: st.logger.info('Attempting to connect to Grafana') - st.browser.get(grafana_url) + st.browser.get(grafana_uri) el = WebDriverWait(st.browser, 15).until( EC.title_contains('Grafana') ) @@ -37,52 +36,15 @@ except TimeoutException: st.browser.quit() sys.exit(1) +logger.info("Attempting to log into Grafana dashboard") try: - st.logger.info('Attempting to login to Grafana') - st.browser.find_element_by_name('username').send_keys(username) - st.browser.find_element_by_name('password').send_keys(password) - st.browser.find_element_by_css_selector( - 'body > grafana-app > div.main-view > div > div:nth-child(1) > div > ' - 'div > div.login-outer-box > div.login-inner-box > form > div.login-button-group > button' - ).click() - st.logger.info("Successfully logged in to Grafana") + browser.find_element_by_name('user').send_keys(username) + browser.find_element_by_name('password').send_keys(password) + browser.find_element_by_class_name('css-6ntnx5-button').click() + logger.info("Successfully logged in to Grafana") except NoSuchElementException: - st.logger.error("Failed to log in to Grafana") - st.browser.quit() - sys.exit(1) - -try: - st.logger.info('Attempting to visit Nodes dashboard') - st.click_link_by_name('OSH Home') - st.click_link_by_name('Nodes') - el = WebDriverWait(st.browser, 15).until( - EC.presence_of_element_located( - (By.XPATH, '/html/body/grafana-app/div/div/div/react-container/div' - '/div[2]/div/div[1]/div/div/div[1]/div/div/div/plugin-component' - '/panel-plugin-graph/grafana-panel/div/div[2]') - ) - ) - st.take_screenshot('Grafana Nodes') -except TimeoutException: - st.logger.error('Failed to load Nodes dashboard') - st.browser.quit() - sys.exit(1) - -try: - st.logger.info('Attempting to visit Cluster Status dashboard') - st.click_link_by_name('Nodes') - st.click_link_by_name('Kubernetes Cluster Status') - el = WebDriverWait(st.browser, 15).until( - EC.presence_of_element_located( - (By.XPATH, '/html/body/grafana-app/div/div/div/react-container/div' - '/div[2]/div/div[1]/div/div/div[5]/div/div/div/plugin-component' - '/panel-plugin-singlestat/grafana-panel/div') - ) - ) - st.take_screenshot('Grafana Cluster Status') -except TimeoutException: - st.logger.error('Failed to load Cluster Status dashboard') - st.browser.quit() + logger.error("Failed to log in to Grafana") + browser.quit() sys.exit(1) st.browser.quit()