Merge "Fixes for consistency after code inspection"

This commit is contained in:
Jenkins 2016-10-03 14:31:56 +00:00 committed by Gerrit Code Review
commit bd151c4956
9 changed files with 27 additions and 23 deletions

View File

@ -32,6 +32,7 @@ class MainPage(base_pages.PageObject):
self._page_title = "Logs - Dashboard - Kibana" self._page_title = "Logs - Dashboard - Kibana"
def is_main_page(self): def is_main_page(self):
# TODO(rpromyshlennikov): fix unresolved attribute ._main_menu_locator
return (self.is_the_current_page() and return (self.is_the_current_page() and
self._is_element_visible(*self._main_menu_locator)) self._is_element_visible(*self._main_menu_locator))

View File

@ -95,18 +95,20 @@ def check_local_mail(remote, node_name, service, state, timeout=10 * 60):
:type remote: SSHClient :type remote: SSHClient
:param node_name: name of the node to check for email on. :param node_name: name of the node to check for email on.
:type node_name: str :type node_name: str
:param message: message to look for. :param service: service to look for.
:type message: str :type service: str
:param state: status of service to check.
:type state: str
:param timeout: timeout to wait for email to arrive. :param timeout: timeout to wait for email to arrive.
:rtype timeout: int :rtype timeout: int
""" """
def check_mail(): def check_mail():
try: try:
responce = remote.check_call("cat $MAIL") response = remote.check_call("cat $MAIL")
if not responce: if not response:
return False return False
if ("Service: {}\n".format(service) in responce['stdout'] and if ("Service: {}\n".format(service) in response['stdout'] and
"State: {}\n".format(state) in responce['stdout']): "State: {}\n".format(state) in response['stdout']):
return True return True
except DevopsCalledProcessError: except DevopsCalledProcessError:
return False return False

View File

@ -13,9 +13,9 @@
import contextlib import contextlib
from proboscis import asserts from proboscis import asserts
import selenium.common.exceptions as Exceptions import selenium.common.exceptions as exceptions
from selenium.webdriver.remote import webelement from selenium.webdriver.remote import webelement
import selenium.webdriver.support.ui as Support import selenium.webdriver.support.ui as support
class BaseWebObject(object): class BaseWebObject(object):
@ -42,14 +42,14 @@ class BaseWebObject(object):
try: try:
self._get_element(*locator) self._get_element(*locator)
return True return True
except Exceptions.NoSuchElementException: except exceptions.NoSuchElementException:
return False return False
def _is_element_visible(self, *locator): def _is_element_visible(self, *locator):
try: try:
return self._get_element(*locator).is_displayed() return self._get_element(*locator).is_displayed()
except (Exceptions.NoSuchElementException, except (exceptions.NoSuchElementException,
Exceptions.ElementNotVisibleException): exceptions.ElementNotVisibleException):
return False return False
def _is_element_displayed(self, element): def _is_element_displayed(self, element):
@ -60,8 +60,8 @@ class BaseWebObject(object):
return element.is_displayed() return element.is_displayed()
else: else:
return element.src_elem.is_displayed() return element.src_elem.is_displayed()
except (Exceptions.ElementNotVisibleException, except (exceptions.ElementNotVisibleException,
Exceptions.StaleElementReferenceException): exceptions.StaleElementReferenceException):
return False return False
def _is_text_visible(self, element, text, strict=True): def _is_text_visible(self, element, text, strict=True):
@ -84,15 +84,15 @@ class BaseWebObject(object):
return field_element return field_element
def _select_dropdown(self, value, element): def _select_dropdown(self, value, element):
select = Support.Select(element) select = support.Select(element)
select.select_by_visible_text(value) select.select_by_visible_text(value)
def _select_dropdown_by_value(self, value, element): def _select_dropdown_by_value(self, value, element):
select = Support.Select(element) select = support.Select(element)
select.select_by_value(value) select.select_by_value(value)
def _get_dropdown_options(self, element): def _get_dropdown_options(self, element):
select = Support.Select(element) select = support.Select(element)
return select.options return select.options

View File

@ -84,6 +84,7 @@ class InfluxdbPluginApi(base_test.PluginApi):
user=plugin_settings.influxdb_user, user=plugin_settings.influxdb_user,
password=plugin_settings.influxdb_pass, password=plugin_settings.influxdb_pass,
expected_code=200): expected_code=200):
logger.debug("Making query to Influx DB: {}".format(query))
return self.checkers.check_http_get_response( return self.checkers.check_http_get_response(
url=self.get_influxdb_url('query'), url=self.get_influxdb_url('query'),
expected_code=expected_code, expected_code=expected_code,
@ -200,7 +201,7 @@ class InfluxdbPluginApi(base_test.PluginApi):
"backend='{0}' AND state='{1}' and " "backend='{0}' AND state='{1}' and "
"time > now() - {2}".format(service, node_state, interval)) "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)) "in '{1}' state!".format(service, node_state))
self._check_influx_query_last_value(query, expected_count, msg_header) self._check_influx_query_last_value(query, expected_count, msg_header)

View File

@ -149,7 +149,7 @@ class TestLMAInfraAlertingPlugin(api.InfraAlertingPluginApi):
"uninstall", "lma_infrastructure_alerting", "smoke"]) "uninstall", "lma_infrastructure_alerting", "smoke"])
@log_snapshot_after_test @log_snapshot_after_test
def uninstall_deployed_lma_infrastructure_alerting(self): 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 environment
Scenario: Scenario:

View File

@ -34,7 +34,7 @@ class TestToolchainHTTPs(api.ToolchainApi):
1. Upload the LMA Toolchain plugins to the master node 1. Upload the LMA Toolchain plugins to the master node
2. Install the plugins 2. Install the plugins
3. Create the cluster 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 5. Create ssl certificate for influxdb_grafana plugin
6. Create ssl certificate for elasticsearch_kibana plugin 6. Create ssl certificate for elasticsearch_kibana plugin
7. Create ssl certificate for lma_infrastructure_alerting plugin 7. Create ssl certificate for lma_infrastructure_alerting plugin

View File

@ -101,7 +101,7 @@ class TestToolchainReducedFootprint(api.ToolchainApi):
"Spawning 1 virtual machine on node {}".format(virt_node["id"])) "Spawning 1 virtual machine on node {}".format(virt_node["id"]))
fuel_web.spawn_vms_wait(self.helpers.cluster_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, wait(lambda: len(nailgun_client.list_nodes()) == 4,
timeout=10 * 60, timeout=10 * 60,
timeout_msg=("Timeout waiting for 4 nodes to be ready, " timeout_msg=("Timeout waiting for 4 nodes to be ready, "

View File

@ -154,7 +154,7 @@ class TestNodesToolchain(api.ToolchainApi):
"""Run fuel-createmirror and deploy environment """Run fuel-createmirror and deploy environment
Scenario: 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. install the plugins.
2. Run the following command on the master node: 2. Run the following command on the master node:
fuel-createmirror fuel-createmirror

View File

@ -25,7 +25,7 @@ export ALWAYS_CREATE_DIAGNOSTIC_SNAPSHOT=${ALWAYS_CREATE_DIAGNOSTIC_SNAPSHOT:-tr
# Export specified settings # Export specified settings
if [ -z $NODE_VOLUME_SIZE ]; then export NODE_VOLUME_SIZE=350; fi if [ -z $NODE_VOLUME_SIZE ]; then export NODE_VOLUME_SIZE=350; fi
if [ -z $OPENSTACK_RELEASE ]; then export OPENSTACK_RELEASE=Ubuntu; 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_MEMORY ]; then export ADMIN_NODE_MEMORY=3072; fi
if [ -z $ADMIN_NODE_CPU ]; then export ADMIN_NODE_CPU=2; 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 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 -K - Keep test environment after tests are finished
-h - Show this help page -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. 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 You can override following variables using export VARNAME="value" before running this script