From 01a13d03dce78f6662b162cda6ec403da3b77ff4 Mon Sep 17 00:00:00 2001 From: Rodion Promyshlennikov Date: Thu, 29 Sep 2016 20:53:00 +0300 Subject: [PATCH] Fixes for consistency after code inspection Fixed imports. Fixed many typos. Change-Id: I724661040d270fead6b6c3c65ae74bda1d2144e9 --- .../elasticsearch_kibana/kibana_ui/pages.py | 1 + stacklight_tests/helpers/checkers.py | 14 +++++++------ stacklight_tests/helpers/ui/base_pages.py | 20 +++++++++---------- stacklight_tests/influxdb_grafana/api.py | 3 ++- .../test_smoke_bvt.py | 2 +- .../toolchain/test_https_plugins.py | 2 +- .../toolchain/test_reduced_footprint.py | 2 +- stacklight_tests/toolchain/test_system.py | 2 +- utils/jenkins/system_tests.sh | 4 ++-- 9 files changed, 27 insertions(+), 23 deletions(-) diff --git a/stacklight_tests/elasticsearch_kibana/kibana_ui/pages.py b/stacklight_tests/elasticsearch_kibana/kibana_ui/pages.py index e1cca53..5fc8101 100644 --- a/stacklight_tests/elasticsearch_kibana/kibana_ui/pages.py +++ b/stacklight_tests/elasticsearch_kibana/kibana_ui/pages.py @@ -29,6 +29,7 @@ class MainPage(base_pages.PageObject): self._page_title = "Logs - Dashboard - Kibana" def is_main_page(self): + # TODO(rpromyshlennikov): fix unresolved attribute ._main_menu_locator return (self.is_the_current_page() and self._is_element_visible(*self._main_menu_locator)) diff --git a/stacklight_tests/helpers/checkers.py b/stacklight_tests/helpers/checkers.py index b11c4d1..4adaef9 100644 --- a/stacklight_tests/helpers/checkers.py +++ b/stacklight_tests/helpers/checkers.py @@ -95,18 +95,20 @@ def check_local_mail(remote, node_name, service, state, timeout=10 * 60): :type remote: SSHClient :param node_name: name of the node to check for email on. :type node_name: str - :param message: message to look for. - :type message: str + :param service: service to look for. + :type service: str + :param state: status of service to check. + :type state: str :param timeout: timeout to wait for email to arrive. :rtype timeout: int """ def check_mail(): try: - responce = remote.check_call("cat $MAIL") - if not responce: + response = remote.check_call("cat $MAIL") + if not response: return False - if ("Service: {}\n".format(service) in responce['stdout'] and - "State: {}\n".format(state) in responce['stdout']): + if ("Service: {}\n".format(service) in response['stdout'] and + "State: {}\n".format(state) in response['stdout']): return True except DevopsCalledProcessError: return False diff --git a/stacklight_tests/helpers/ui/base_pages.py b/stacklight_tests/helpers/ui/base_pages.py index 24edb1a..0ea6ac4 100644 --- a/stacklight_tests/helpers/ui/base_pages.py +++ b/stacklight_tests/helpers/ui/base_pages.py @@ -13,9 +13,9 @@ import contextlib from proboscis import asserts -import selenium.common.exceptions as Exceptions +import selenium.common.exceptions as exceptions from selenium.webdriver.remote import webelement -import selenium.webdriver.support.ui as Support +import selenium.webdriver.support.ui as support class BaseWebObject(object): @@ -42,14 +42,14 @@ class BaseWebObject(object): try: self._get_element(*locator) return True - except Exceptions.NoSuchElementException: + except exceptions.NoSuchElementException: return False def _is_element_visible(self, *locator): try: return self._get_element(*locator).is_displayed() - except (Exceptions.NoSuchElementException, - Exceptions.ElementNotVisibleException): + except (exceptions.NoSuchElementException, + exceptions.ElementNotVisibleException): return False def _is_element_displayed(self, element): @@ -60,8 +60,8 @@ class BaseWebObject(object): return element.is_displayed() else: return element.src_elem.is_displayed() - except (Exceptions.ElementNotVisibleException, - Exceptions.StaleElementReferenceException): + except (exceptions.ElementNotVisibleException, + exceptions.StaleElementReferenceException): return False def _is_text_visible(self, element, text, strict=True): @@ -84,15 +84,15 @@ class BaseWebObject(object): return field_element def _select_dropdown(self, value, element): - select = Support.Select(element) + select = support.Select(element) select.select_by_visible_text(value) def _select_dropdown_by_value(self, value, element): - select = Support.Select(element) + select = support.Select(element) select.select_by_value(value) def _get_dropdown_options(self, element): - select = Support.Select(element) + select = support.Select(element) return select.options diff --git a/stacklight_tests/influxdb_grafana/api.py b/stacklight_tests/influxdb_grafana/api.py index 91f35b4..e6f0901 100644 --- a/stacklight_tests/influxdb_grafana/api.py +++ b/stacklight_tests/influxdb_grafana/api.py @@ -84,6 +84,7 @@ class InfluxdbPluginApi(base_test.PluginApi): user=plugin_settings.influxdb_user, password=plugin_settings.influxdb_pass, expected_code=200): + logger.debug("Making query to Influx DB: {}".format(query)) return self.checkers.check_http_get_response( url=self.get_influxdb_url('query'), expected_code=expected_code, @@ -200,7 +201,7 @@ class InfluxdbPluginApi(base_test.PluginApi): "backend='{0}' AND state='{1}' and " "time > now() - {2}".format(service, node_state, interval)) - msg_header = ("Wrong amout of nodes with service '{0}' " + msg_header = ("Wrong amount of nodes with service '{0}' " "in '{1}' state!".format(service, node_state)) self._check_influx_query_last_value(query, expected_count, msg_header) diff --git a/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py b/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py index 651cd22..269be87 100644 --- a/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py +++ b/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py @@ -149,7 +149,7 @@ class TestLMAInfraAlertingPlugin(api.InfraAlertingPluginApi): "uninstall", "lma_infrastructure_alerting", "smoke"]) @log_snapshot_after_test def uninstall_deployed_lma_infrastructure_alerting(self): - """Uninstall the LMA Infrastructure Alering plugin with a deployed + """Uninstall the LMA Infrastructure Alerting plugin with a deployed environment Scenario: diff --git a/stacklight_tests/toolchain/test_https_plugins.py b/stacklight_tests/toolchain/test_https_plugins.py index 318f3cc..9fc6dd6 100644 --- a/stacklight_tests/toolchain/test_https_plugins.py +++ b/stacklight_tests/toolchain/test_https_plugins.py @@ -34,7 +34,7 @@ class TestToolchainHTTPs(api.ToolchainApi): 1. Upload the LMA Toolchain plugins to the master node 2. Install the plugins 3. Create the cluster - 4. Uplaod script for ssl certificate creation + 4. Upload script for ssl certificate creation 5. Create ssl certificate for influxdb_grafana plugin 6. Create ssl certificate for elasticsearch_kibana plugin 7. Create ssl certificate for lma_infrastructure_alerting plugin diff --git a/stacklight_tests/toolchain/test_reduced_footprint.py b/stacklight_tests/toolchain/test_reduced_footprint.py index d181f55..5a71ba4 100644 --- a/stacklight_tests/toolchain/test_reduced_footprint.py +++ b/stacklight_tests/toolchain/test_reduced_footprint.py @@ -101,7 +101,7 @@ class TestToolchainReducedFootprint(api.ToolchainApi): "Spawning 1 virtual machine on node {}".format(virt_node["id"])) fuel_web.spawn_vms_wait(self.helpers.cluster_id) - logger.info("Waiting for the virtual manchine to be up...") + logger.info("Waiting for the virtual machine to be up...") wait(lambda: len(nailgun_client.list_nodes()) == 4, timeout=10 * 60, timeout_msg=("Timeout waiting for 4 nodes to be ready, " diff --git a/stacklight_tests/toolchain/test_system.py b/stacklight_tests/toolchain/test_system.py index c3b8caa..58525d2 100644 --- a/stacklight_tests/toolchain/test_system.py +++ b/stacklight_tests/toolchain/test_system.py @@ -154,7 +154,7 @@ class TestNodesToolchain(api.ToolchainApi): """Run fuel-createmirror and deploy environment Scenario: - 1. Copy the LMA Toolchais plugins to the Fuel Master node and + 1. Copy the LMA Toolchain plugins to the Fuel Master node and install the plugins. 2. Run the following command on the master node: fuel-createmirror diff --git a/utils/jenkins/system_tests.sh b/utils/jenkins/system_tests.sh index 7b55ffb..cdabb41 100755 --- a/utils/jenkins/system_tests.sh +++ b/utils/jenkins/system_tests.sh @@ -25,7 +25,7 @@ export ALWAYS_CREATE_DIAGNOSTIC_SNAPSHOT=${ALWAYS_CREATE_DIAGNOSTIC_SNAPSHOT:-tr # Export specified settings if [ -z $NODE_VOLUME_SIZE ]; then export NODE_VOLUME_SIZE=350; fi if [ -z $OPENSTACK_RELEASE ]; then export OPENSTACK_RELEASE=Ubuntu; fi -if [ -z $ENV_NAME ]; then export ENV_NAME="elasticsearch_kibana"; fi +if [ -z $ENV_NAME ]; then export ENV_NAME="stacklight"; fi if [ -z $ADMIN_NODE_MEMORY ]; then export ADMIN_NODE_MEMORY=3072; fi if [ -z $ADMIN_NODE_CPU ]; then export ADMIN_NODE_CPU=2; fi if [ -z $SLAVE_NODE_MEMORY ]; then export SLAVE_NODE_MEMORY=4096; fi @@ -73,7 +73,7 @@ if you do need to override them. -K - Keep test environment after tests are finished -h - Show this help page -Most variables uses guesing from Jenkins' job name but can be overriden +Most variables uses guessing from Jenkins' job name but can be overridden by exported variable before script is run or by one of command line options. You can override following variables using export VARNAME="value" before running this script