Merge "Repclace import ... as ... by direct imports"

This commit is contained in:
Jenkins 2016-02-29 14:12:35 +00:00 committed by Gerrit Code Review
commit 026e9c6b61
22 changed files with 106 additions and 510 deletions

View File

@ -36,11 +36,6 @@ Test Bond offloading types
.. automodule:: fuelweb_test.tests.test_bond_offloading
:members:
Test By Tempest
---------------
.. automodule:: fuelweb_test.tests.test_by_tempest
:members:
Test Ceph
---------
.. automodule:: fuelweb_test.tests.test_ceph

View File

@ -18,11 +18,6 @@ Common
.. automodule:: fuelweb_test.helpers.common
:members:
Conf tempest
------------
.. automodule:: fuelweb_test.helpers.conf_tempest
:members:
Decorators
----------
.. automodule:: fuelweb_test.helpers.decorators

View File

@ -1,159 +0,0 @@
# Copyright 2014 Mirantis, Inc.
#
# 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 argparse
import os
import jinja2
from fuelweb_test import logger
from fuelweb_test.models import nailgun_client
from fuelweb_test.helpers import os_actions
class TempestConfigState(object):
"""TempestConfigState.""" # TODO documentation
default_options = {'username': 'test',
'password': 'test',
'tenant_name': 'test',
'alt_username': 'alt_test',
'alt_password': 'alt_test',
'alt_tenant_name': 'alt_test',
'image_name': 'TestVM'}
def __init__(self, admin_ip, cluster_id,
tempest_conf=None, **kwargs):
self.cluster_id = str(cluster_id)
self.admin_ip = admin_ip
self.tempest_template = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'tempest.conf.template')
self.tempest_conf = tempest_conf
self.options = dict(self.default_options, **kwargs)
def configure_nailgun(self):
"""Should be used for configuration that can be
gathered from nailgun api, e.g:
1. admin username, password, tenant_name
2. management_vip/public_vip
3. private network cidr
"""
client = nailgun_client.NailgunClient(self.admin_ip)
cluster_info = client.get_cluster(self.cluster_id)
self.options['net_provider'] = cluster_info['net_provider']
self._configure_nailgun_access(client)
self._configure_nailgun_networks(client)
def _configure_nailgun_access(self, client):
cluster_attrs = client.get_cluster_attributes(
self.cluster_id)
access = cluster_attrs['editable']['access']
self.options['admin_username'] = access['user']['value']
self.options['admin_tenant_name'] = access['tenant']['value']
self.options['admin_password'] = access['password']['value']
def _configure_nailgun_networks(self, client):
network_attrs = client.get_networks(self.cluster_id)
networking_params = network_attrs['networking_parameters']
if self.options['net_provider'] == 'neutron':
cidr = networking_params['internal_cidr']
else:
cidr = networking_params['fixed_networks_cidr']
self.options['internal_cidr'] = cidr
_, self.options['internal_mask'] = cidr.split('/')
self.options['management_vip'] = network_attrs['management_vip']
self.options['public_network_name'] = networking_params.get(
'floating_name', 'net04_ext')
self.options['private_network_name'] = networking_params.get(
'internal_name', 'net04')
def configure_openstack(self):
"""
1. Fetch id of TestVM image
2. Fetch id of neutron public network and public router
3. Create non-admin user for keystone
"""
client = os_actions.OpenStackActions(
self.options['management_vip'],
user=self.options['admin_username'],
passwd=self.options['admin_password'],
tenant=self.options['admin_tenant_name'])
self._configure_openstack_keystone(client)
self._configure_openstack_glance(client)
if self.options['net_provider'] == 'neutron':
self._configure_openstack_neutron(client)
else:
self._configure_nova_network(client)
def _configure_openstack_neutron(self, client):
network = client.get_network(self.options['public_network_name'])
router = client.get_router(network)
self.options['public_network'] = network['id']
self.options['public_router'] = router['id']
def _configure_nova_network(self, client):
pass
def _configure_openstack_keystone(self, client):
# Keystone should create tenant/user or return existing
client.create_user_and_tenant(
self.options['tenant_name'],
self.options['username'],
self.options['password'])
client.create_user_and_tenant(
self.options['alt_tenant_name'],
self.options['alt_username'],
self.options['alt_password'])
def _configure_openstack_glance(self, client):
test_image = client.get_image(self.options['image_name'])
self.options['image_ref'] = test_image.id
def configure(self):
self.configure_nailgun()
self.configure_openstack()
def copy_config(self):
with open(self.tempest_template, 'r') as template:
j_template = jinja2.Template(template.read()).render(self.options)
with open(self.tempest_conf, 'w') as conf:
conf.write(j_template)
def main():
parser = argparse.ArgumentParser(description="""
Example: python helpers/conf_tempest.py -c 1 \
-n 10.108.10.2 \
-t /home/fuel/tempest/etc/tempest.conf
""")
parser.add_argument("-n", "--nailgun", help="Provide nailgun node ip.",
required=True)
parser.add_argument("-c", "--cluster", help="Provide cluster id",
required=True)
parser.add_argument(
"-t", "--tempest_config",
help="Path where tempest will look for config",
default='/etc/tempest/tempest.conf')
args = parser.parse_args()
conf = TempestConfigState(
args.nailgun, args.cluster,
tempest_conf=args.tempest_config)
conf.configure()
conf.copy_config()
if __name__ == '__main__':
logger.info('Starting tempest config generation.')
main()
logger.info('Finished tempest config generation.')

View File

@ -35,7 +35,7 @@ from fuelweb_test.settings import FUEL_PLUGIN_BUILDER_REPO
from fuelweb_test.settings import FUEL_USE_LOCAL_NTPD
from fuelweb_test.settings import MIRROR_UBUNTU
from fuelweb_test.settings import PLUGIN_PACKAGE_VERSION
from fuelweb_test import settings as hlp_data
from fuelweb_test.settings import FUEL_SETTINGS_YAML
from fuelweb_test.settings import NESSUS_IMAGE_PATH
@ -329,7 +329,7 @@ class AdminActions(BaseActions):
)
def get_fuel_settings(self):
cmd = 'cat {cfg_file}'.format(cfg_file=hlp_data.FUEL_SETTINGS_YAML)
cmd = 'cat {cfg_file}'.format(cfg_file=FUEL_SETTINGS_YAML)
result = self.ssh_manager.execute(
ip=self.admin_ip,
cmd=cmd
@ -338,7 +338,7 @@ class AdminActions(BaseActions):
fuel_settings = yaml.load(''.join(result['stdout']))
else:
raise Exception('Can\'t output {cfg_file} file: {error}'.
format(cfg_file=hlp_data.FUEL_SETTINGS_YAML,
format(cfg_file=FUEL_SETTINGS_YAML,
error=result['stderr']))
return fuel_settings
@ -346,7 +346,7 @@ class AdminActions(BaseActions):
cmd = 'echo \'{0}\' > {1}'.format(yaml.dump(settings,
default_style='"',
default_flow_style=False),
hlp_data.FUEL_SETTINGS_YAML)
FUEL_SETTINGS_YAML)
result = self.ssh_manager.execute(
ip=self.admin_ip,
cmd=cmd

View File

@ -35,7 +35,7 @@ import yaml
from fuelweb_test import logger
from fuelweb_test import logwrap
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test import QuietLogger
from fuelweb_test.helpers import ceph
from fuelweb_test.helpers import checkers
@ -1943,7 +1943,7 @@ class FuelWebClient(object):
failed_count = []
test_name_to_run = test_name or OSTF_TEST_NAME
retries = test_retries or OSTF_TEST_RETRIES_COUNT
test_path = map_ostf.OSTF_TEST_MAPPING.get(test_name_to_run)
test_path = ostf_test_mapping.OSTF_TEST_MAPPING.get(test_name_to_run)
logger.info('Test path is {0}'.format(test_path))
for i in range(0, retries):

View File

@ -14,7 +14,6 @@
import sys
from proboscis.asserts import assert_true
from proboscis import test
from proboscis import SkipTest

View File

@ -11,14 +11,13 @@
# 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
import sys
from proboscis.asserts import assert_true
from proboscis import test
from proboscis import SkipTest
from fuelweb_test import logger
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.decorators import upload_manifests

View File

@ -20,7 +20,7 @@ from proboscis import test
import requests
from fuelweb_test import logger
from fuelweb_test import settings as conf
from fuelweb_test import settings
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests.base_test_case import SetupEnvironment
@ -69,34 +69,37 @@ class TestLmaCollectorPlugin(TestBasic):
# copy plugins to the master node
checkers.upload_tarball(
remote,
conf.LMA_COLLECTOR_PLUGIN_PATH, "/var")
settings.LMA_COLLECTOR_PLUGIN_PATH, "/var")
checkers.upload_tarball(
remote,
conf.ELASTICSEARCH_KIBANA_PLUGIN_PATH, "/var")
settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH, "/var")
checkers.upload_tarball(
remote,
conf.INFLUXDB_GRAFANA_PLUGIN_PATH, "/var")
settings.INFLUXDB_GRAFANA_PLUGIN_PATH, "/var")
checkers.upload_tarball(
remote,
conf.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var")
settings.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var")
# install plugins
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.LMA_COLLECTOR_PLUGIN_PATH))
plugin=os.path.basename(settings.LMA_COLLECTOR_PLUGIN_PATH))
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.ELASTICSEARCH_KIBANA_PLUGIN_PATH))
plugin=os.path.basename(
settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH))
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.INFLUXDB_GRAFANA_PLUGIN_PATH))
plugin=os.path.basename(
settings.INFLUXDB_GRAFANA_PLUGIN_PATH))
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.LMA_INFRA_ALERTING_PLUGIN_PATH))
plugin=os.path.basename(
settings.LMA_INFRA_ALERTING_PLUGIN_PATH))
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
influxdb_user = "influxdb"

View File

@ -20,7 +20,7 @@ from proboscis import test
import requests
from fuelweb_test import logger
from fuelweb_test import settings as conf
from fuelweb_test import settings
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests.base_test_case import SetupEnvironment
@ -89,16 +89,17 @@ class TestLmaInfraAlertingPlugin(TestBasic):
# copy plugin to the master node
checkers.upload_tarball(
remote,
conf.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var")
settings.LMA_INFRA_ALERTING_PLUGIN_PATH, "/var")
# install plugin
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.LMA_INFRA_ALERTING_PLUGIN_PATH))
plugin=os.path.basename(
settings.LMA_INFRA_ALERTING_PLUGIN_PATH))
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
plugin_options = {

View File

@ -25,7 +25,7 @@ import requests
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test import settings as conf
from fuelweb_test import settings
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
@ -169,14 +169,14 @@ class ZabbixPlugin(TestBasic):
with self.env.d_env.get_admin_remote() as remote:
checkers.upload_tarball(
remote, conf.ZABBIX_PLUGIN_PATH, "/var")
remote, settings.ZABBIX_PLUGIN_PATH, "/var")
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.ZABBIX_PLUGIN_PATH))
plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH))
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
zabbix_username = 'admin'
@ -250,8 +250,8 @@ class ZabbixPlugin(TestBasic):
self.env.revert_snapshot("ready_with_5_slaves")
with self.env.d_env.get_admin_remote() as remote:
for plugin in [conf.ZABBIX_PLUGIN_PATH,
conf.ZABBIX_SNMP_PLUGIN_PATH]:
for plugin in [settings.ZABBIX_PLUGIN_PATH,
settings.ZABBIX_SNMP_PLUGIN_PATH]:
checkers.upload_tarball(
remote, plugin, "/var")
checkers.install_plugin_check_code(
@ -260,7 +260,7 @@ class ZabbixPlugin(TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
zabbix_username = 'admin'
@ -347,9 +347,9 @@ class ZabbixPlugin(TestBasic):
self.env.revert_snapshot("ready_with_5_slaves")
with self.env.d_env.get_admin_remote() as remote:
for plugin in [conf.ZABBIX_PLUGIN_PATH,
conf.ZABBIX_SNMP_PLUGIN_PATH,
conf.ZABBIX_SNMP_EMC_PLUGIN_PATH]:
for plugin in [settings.ZABBIX_PLUGIN_PATH,
settings.ZABBIX_SNMP_PLUGIN_PATH,
settings.ZABBIX_SNMP_EMC_PLUGIN_PATH]:
checkers.upload_tarball(
remote, plugin, "/var")
checkers.install_plugin_check_code(
@ -358,7 +358,7 @@ class ZabbixPlugin(TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
zabbix_username = 'admin'
@ -429,9 +429,9 @@ class ZabbixPlugin(TestBasic):
self.env.revert_snapshot("ready_with_5_slaves")
with self.env.d_env.get_admin_remote() as remote:
for plugin in [conf.ZABBIX_PLUGIN_PATH,
conf.ZABBIX_SNMP_PLUGIN_PATH,
conf.ZABBIX_SNMP_EXTREME_PLUGIN_PATH]:
for plugin in [settings.ZABBIX_PLUGIN_PATH,
settings.ZABBIX_SNMP_PLUGIN_PATH,
settings.ZABBIX_SNMP_EXTREME_PLUGIN_PATH]:
checkers.upload_tarball(
remote, plugin, "/var")
checkers.install_plugin_check_code(
@ -440,7 +440,7 @@ class ZabbixPlugin(TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
zabbix_username = 'admin'
@ -512,19 +512,19 @@ class ZabbixPlugin(TestBasic):
with self.env.d_env.get_admin_remote() as remote:
checkers.upload_tarball(
remote, conf.ZABBIX_PLUGIN_PATH, "/var")
remote, settings.ZABBIX_PLUGIN_PATH, "/var")
checkers.install_plugin_check_code(
remote,
plugin=os.path.basename(conf.ZABBIX_PLUGIN_PATH))
plugin=os.path.basename(settings.ZABBIX_PLUGIN_PATH))
settings = {}
if conf.NEUTRON_ENABLE:
settings = {
cluster_settings = {}
if settings.NEUTRON_ENABLE:
cluster_settings = {
"net_provider": "neutron",
"net_segment_type": conf.NEUTRON_SEGMENT_TYPE
"net_segment_type": settings.NEUTRON_SEGMENT_TYPE
}
settings.update(
cluster_settings.update(
{
'volumes_ceph': True,
'images_ceph': True,
@ -537,8 +537,8 @@ class ZabbixPlugin(TestBasic):
)
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=conf.DEPLOYMENT_MODE,
settings=settings
mode=settings.DEPLOYMENT_MODE,
settings=cluster_settings
)
zabbix_username = 'admin'

View File

@ -1,236 +0,0 @@
# Copyright 2014 Mirantis, Inc.
#
# 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.
"""Launchers for Tempest scenarios
To launch these Fuel-tests, you should specify several properties in global
environment.
Tempest should be configured with your cluster. You can do it manually and set
path to existing configuration file in TEMPEST_CONFIG_FILE. Automatic
configuration is also presented and required cluster name
(variable: CLUSTER_NAME) and name of environment (variable: PARENT_ENV_NAME),
wherein the cluster has been created.
Another important variable is name of snapshot (variable: SNAPSHOT) which
Tempest will verify.
Optional properties:
- TEMPEST_PATH: path to Tempest (default: './tempest')
- TEMPEST_XML_LOG_FILE: path to file which will store results of
verification in JUnit XML format
(default: './logs/$EXEC_NUMBER_tempest.xml')
Cheat:
- TEMPEST_GOD_MODE: if you specify this variable, fuel-tests will be
marked as failed (will raise exception) only when xml log file is
missed(don't matter Tempest scenarios are finished successfully or
some of them are crashed).
"""
import errno
import os
import subprocess as sp
import tempfile
from xml.etree import ElementTree
from proboscis import SkipTest
from proboscis import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.models import nailgun_client as nc
from fuelweb_test.tests import base_test_case
from fuelweb_test.helpers import conf_tempest
def _prepare_and_run(*testr_args):
""" Prepare and run Tempest scenarios via testr.
Required variables in environment: CLUSTER_NAME, PARENT_ENV_NAME,
TEMPEST_PATH, TEMPEST_CONFIG_FILE, EXECUTOR_NUMBER,
TEMPEST_XML_LOG_FILE, TEMPEST_GOD_MODE
"""
# Preparation
cluster = os.environ.get("CLUSTER_NAME")
env_name = os.environ.get("PARENT_ENV_NAME")
tempest_path = os.environ.get("TEMPEST_PATH", "./tempest")
tempest_conf = os.environ.get("TEMPEST_CONFIG_FILE")
exec_number = os.environ.get("EXECUTOR_NUMBER")
xml_logfile = os.environ.get("TEMPEST_XML_LOG_FILE",
"./logs/%s_tempest.xml" % exec_number)
god_mode = os.environ.get("TEMPEST_GOD_MODE", False)
# Check the possibility of configuration Tempest
if not tempest_conf and (not env_name and not cluster):
raise ValueError(
"Use should specify Tempest configuration file or environment and "
"cluster names for generation configuration file.")
# Prepare directory for log file
try:
os.makedirs(os.path.dirname(xml_logfile))
except OSError as exc:
if exc.errno == errno.EEXIST:
if not os.path.isdir(os.path.dirname(xml_logfile)):
raise
else:
raise
if not tempest_conf:
tempest_conf = tempfile.NamedTemporaryFile().name
# Get nailgun node ip address
netdump = sp.Popen(["virsh", "net-dumpxml", "%s_admin" % env_name],
stdout=sp.PIPE).communicate()[0]
try:
network = ElementTree.fromstring(netdump).find('ip')
node_ip = "%s2" % network.attrib['address'][:-1]
except (AttributeError, KeyError):
raise ValueError(
"Nailgun node ip address can not be obtained using the "
"specified name of environment('%s')" % env_name)
cluster_id = nc.NailgunClient(node_ip).get_cluster_id(cluster)
if not cluster_id:
raise ValueError(
"Cluster id can not be obtained by using specified envname"
"('%(env_name)s') and discovered nailgun node ip address"
"('%(ip_address)s')." % {"env_name": env_name,
"ip_address": node_ip})
# Generate config file
conf = conf_tempest.TempestConfigState(
node_ip, cluster_id, tempest_conf)
conf.configure()
conf.copy_config()
# Tempest needs modified environment
tempest_env = os.environ.copy()
tempest_env["TEMPEST_CONFIG_DIR"] = tempest_path
tempest_env["TEMPEST_CONFIG"] = os.path.basename(tempest_conf)
tempest_env["OS_TEST_PATH"] = os.path.join(
tempest_path, "tempest/test_discover")
# Run Tempest
tempest_cmd = ["testr", "run", "--parallel", "--subunit"]
tempest_cmd.extend(testr_args)
to_xml_cmd = ['subunit2junitxml' '--output-to', xml_logfile]
try:
tempest_process = sp.Popen(tempest_cmd, cwd=tempest_path,
env=tempest_env, stdout=sp.PIPE)
sp.check_call(to_xml_cmd, stdin=tempest_process.stdout,
cwd=tempest_path)
except sp.CalledProcessError:
if god_mode and not os.path.exists(xml_logfile):
raise RuntimeError(
"An error occurred during the execution of Tempest. "
"Please see log files for detailed information.")
elif not god_mode:
raise RuntimeError(
"Tempest tests are finished with errors. Please see xml "
"file with results for detailed information.")
@test(groups=["tempest"])
class TestByTempest(base_test_case.TestBasic):
"""TestByTempest.""" # TODO documentation
def revert_snapshot(self):
""" Prepare snapshot specified in environment"""
success = self.env.revert_snapshot(os.environ.get("SNAPSHOT"))
if not success:
raise SkipTest()
@test(groups=["tempest_set"])
@log_snapshot_after_test
def tempest_set(self):
"""Prepare cluster and launch Tempest tests from TEMPEST_TEST_SET
Scenario:
1. Revert cluster(snapshot) which Tempest will test.
2. Prepare Tempest:
- Discover nailgun node ip and cluster id (if Tempest
configuration file is not presented)
- Modify environment
3. Validate cluster with set of Tempest-tests
Specific test variable:
TEMPEST_TEST_SET - name of Tempest tests set, which will be
launched. Allowed names:
- full (used by default)
- smoke
- baremetal
- compute
- data_processing
- identity
- image
- network
- object_storage
- orchestration
- telemetry
- volume
"""
self.revert_snapshot()
# Parse Tempest set name
tempest_set = os.environ.get("TEMPEST_TEST_SET", "")
if tempest_set and tempest_set not in ['full', 'smoke']:
tempest_set = "tempest.api.%s" % tempest_set
elif tempest_set != "smoke":
tempest_set = ""
_prepare_and_run(tempest_set)
@test(groups=["tempest_list"])
@log_snapshot_after_test
def tempest_list(self):
"""Prepare cluster and launch Tempest tests from TEMPEST_TESTS_LIST
Scenario:
1. Revert cluster(snapshot) which Tempest will test.
2. Prepare Tempest:
- Discover nailgun node ip and cluster id (if Tempest
configuration file is not presented)
- Modify environment
3. Validate cluster with list of Tempest-tests
Specific test variable:
TEMPEST_TESTS_LIST - path to file with names of Tempests-tests
(structure of file: each name on a separate line)
"""
self.revert_snapshot()
file_with_tests = os.environ.get("TEMPEST_TESTS_LIST")
if not os.path.exists(file_with_tests):
raise ValueError(
"File %s should not exist. Please, specify correct path to "
"file, which contains list of tests." % file_with_tests)
_prepare_and_run("list-tests", file_with_tests)

View File

@ -27,7 +27,7 @@ from fuelweb_test.helpers import ceph
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.ovs import ovs_get_tag_by_port
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test import settings
from fuelweb_test import logger
from fuelweb_test.tests.base_test_case import SetupEnvironment
@ -593,7 +593,7 @@ class VmBackedWithCephMigrationBasic(TestBasic):
def _check():
# Run volume test several times with hope that it pass
test_path = map_ostf.OSTF_TEST_MAPPING.get(
test_path = ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance')
logger.debug('Start to run test {0}'.format(test_path))
self.fuel_web.run_single_ostf_test(

View File

@ -20,12 +20,12 @@ from proboscis import test
from proboscis import SkipTest
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests import base_test_case as base_test_data
from fuelweb_test.tests import base_test_case
from fuelweb_test.tests.test_os_upgrade import TestOSupgrade
@test(groups=["clone_env_for_os_upgrade", "os_upgrade"])
class TestCloneEnv(base_test_data.TestBasic):
class TestCloneEnv(base_test_case.TestBasic):
@test(
depends_on=[TestOSupgrade.upgrade_ha_ceph_for_all_ubuntu_neutron_vlan],

View File

@ -16,7 +16,7 @@ from proboscis import asserts
from proboscis import test
from fuelweb_test.helpers.decorators import check_fuel_statistics
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test import settings as hlp_data
from fuelweb_test import settings
from fuelweb_test.tests import base_test_case
@ -51,7 +51,7 @@ class EnvironmentAction(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
settings={
'tenant': 'stop_deploy',
'user': 'stop_deploy',
@ -114,7 +114,7 @@ class EnvironmentAction(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
self.fuel_web.update_nodes(
cluster_id,
@ -174,7 +174,7 @@ class EnvironmentAction(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
)
self.fuel_web.update_nodes(
cluster_id,
@ -228,7 +228,7 @@ class EnvironmentActionOnHA(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE_HA,
mode=settings.DEPLOYMENT_MODE_HA,
)
self.fuel_web.update_nodes(
cluster_id,
@ -296,7 +296,7 @@ class ControllerReplacement(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE_HA,
mode=settings.DEPLOYMENT_MODE_HA,
settings=data
)
@ -350,7 +350,7 @@ class ControllerReplacement(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE_HA,
mode=settings.DEPLOYMENT_MODE_HA,
settings=data
)
@ -404,7 +404,7 @@ class ControllerReplacement(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_data.DEPLOYMENT_MODE_HA,
mode=settings.DEPLOYMENT_MODE_HA,
)
self.fuel_web.update_nodes(

View File

@ -20,12 +20,12 @@ from proboscis import test
from proboscis import SkipTest
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests import base_test_case as base_test_data
from fuelweb_test.tests import base_test_case
from fuelweb_test.tests.test_os_upgrade import TestOSupgrade
@test(groups=["reassign_node_for_os_upgrade", "os_upgrade"])
class TestReassignNode(base_test_data.TestBasic):
class TestReassignNode(base_test_case.TestBasic):
@test(
depends_on=[TestOSupgrade.upgrade_ha_ceph_for_all_ubuntu_neutron_vlan],

View File

@ -23,15 +23,14 @@ from proboscis import SkipTest
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.utils import install_pkg
from fuelweb_test.tests import base_test_case as base_test_data
from fuelweb_test import settings as hlp_data
from fuelweb_test.settings import DEPLOYMENT_MODE_HA
from fuelweb_test.tests import base_test_case
from fuelweb_test import settings
@test(groups=["prepare_os_upgrade"])
class PrepareOSupgrade(base_test_data.TestBasic):
class PrepareOSupgrade(base_test_case.TestBasic):
@test(depends_on=[base_test_data.SetupEnvironment.prepare_slaves_9],
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_9],
groups=["ha_ceph_for_all_ubuntu_neutron_vlan"])
@log_snapshot_after_test
def ha_ceph_for_all_ubuntu_neutron_vlan(self):
@ -48,7 +47,7 @@ class PrepareOSupgrade(base_test_data.TestBasic):
Duration 50m
Snapshot ha_ceph_for_all_ubuntu_neutron_vlan
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('ha_ceph_for_all_ubuntu_neutron_vlan')
@ -61,12 +60,12 @@ class PrepareOSupgrade(base_test_data.TestBasic):
'objects_ceph': True,
'volumes_lvm': False,
'net_provider': 'neutron',
'net_segment_type': hlp_data.NEUTRON_SEGMENT['vlan']
'net_segment_type': settings.NEUTRON_SEGMENT['vlan']
}
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE_HA,
mode=settings.DEPLOYMENT_MODE_HA,
settings=data
)
@ -89,7 +88,7 @@ class PrepareOSupgrade(base_test_data.TestBasic):
@test(groups=["os_upgrade"])
class TestOSupgrade(base_test_data.TestBasic):
class TestOSupgrade(base_test_case.TestBasic):
@test(groups=["upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"])
@log_snapshot_after_test
@ -102,7 +101,7 @@ class TestOSupgrade(base_test_data.TestBasic):
3. Check that upgrade was successful
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('upgrade_ha_ceph_for_all_ubuntu_neutron_vlan')
@ -115,7 +114,7 @@ class TestOSupgrade(base_test_data.TestBasic):
self.fuel_web.assert_nodes_in_ready_state(cluster_id)
self.fuel_web.wait_nodes_get_online_state(
self.env.d_env.nodes().slaves[:6])
self.fuel_web.assert_fuel_version(hlp_data.UPGRADE_FUEL_TO)
self.fuel_web.assert_fuel_version(settings.UPGRADE_FUEL_TO)
self.fuel_web.assert_nailgun_upgrade_migration()
self.env.make_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
@ -135,7 +134,7 @@ class TestOSupgrade(base_test_data.TestBasic):
5. Create mirrors
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('prepare_before_os_upgrade')
@ -166,7 +165,7 @@ class TestOSupgrade(base_test_data.TestBasic):
2. run octane upgrade-env <target_env_id>
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('os_upgrade_env')
@ -198,7 +197,7 @@ class TestOSupgrade(base_test_data.TestBasic):
2. run octane upgrade-node --isolated <seed_env_id> <node_id>
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('upgrade_first_cic')
@ -241,7 +240,7 @@ class TestOSupgrade(base_test_data.TestBasic):
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('upgrade_db')
@ -325,7 +324,7 @@ class TestOSupgrade(base_test_data.TestBasic):
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('upgrade_ceph')
@ -369,7 +368,7 @@ class TestOSupgrade(base_test_data.TestBasic):
"""
if hlp_data.OPENSTACK_RELEASE_UBUNTU not in hlp_data.OPENSTACK_RELEASE:
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
self.check_run('upgrade_control_plane')

View File

@ -26,7 +26,7 @@ from fuelweb_test.helpers.checkers import check_auto_mode
from fuelweb_test.helpers.checkers import check_available_mode
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test import logger
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test import settings
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
@ -170,7 +170,7 @@ class CICMaintenanceMode(TestBasic):
_wait(lambda:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['sanity'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Check that required services are running')),
timeout=1500)
logger.debug("Required services are running")
@ -299,7 +299,7 @@ class CICMaintenanceMode(TestBasic):
_wait(lambda:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['sanity'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Check that required services are running')),
timeout=1500)
logger.debug("Required services are running")
@ -473,7 +473,7 @@ class CICMaintenanceMode(TestBasic):
_wait(lambda:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['sanity'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Check that required services are running')),
timeout=1500)
logger.debug("Required services are running")

View File

@ -18,7 +18,7 @@ from proboscis import test
from proboscis.asserts import assert_true
from fuelweb_test import logger
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test import settings
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.decorators import setup_teardown
@ -123,7 +123,7 @@ class Load(TestLoadBase):
try:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
except AssertionError:
logger.debug("Test failed from first probe,"
@ -132,7 +132,7 @@ class Load(TestLoadBase):
time.sleep(180)
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
self.show_step(11)
# LB 1519018

View File

@ -16,7 +16,7 @@
from proboscis import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test import settings as hlp_date
from fuelweb_test import settings
from fuelweb_test.tests import base_test_case
@ -47,10 +47,10 @@ class OstfRepeatableTests(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_date.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
settings={
'net_provider': 'neutron',
'net_segment_type': hlp_date.NEUTRON_SEGMENT['vlan']
'net_segment_type': settings.NEUTRON_SEGMENT['vlan']
}
)
self.fuel_web.update_nodes(
@ -91,10 +91,10 @@ class OstfRepeatableTests(base_test_case.TestBasic):
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_date.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
settings={
'net_provider': 'neutron',
'net_segment_type': hlp_date.NEUTRON_SEGMENT['tun']
'net_segment_type': settings.NEUTRON_SEGMENT['tun']
}
)
self.fuel_web.update_nodes(
@ -115,5 +115,5 @@ class OstfRepeatableTests(base_test_case.TestBasic):
@log_snapshot_after_test
def run_ostf_n_times_against_custom_deployment(self):
cluster_id = self.fuel_web.client.get_cluster_id(
hlp_date.DEPLOYMENT_NAME)
settings.DEPLOYMENT_NAME)
self.fuel_web.run_ostf_repeatably(cluster_id)

View File

@ -18,7 +18,7 @@ from proboscis import test
from proboscis.asserts import assert_true
from fuelweb_test import logger
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test import settings
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.helpers.decorators import setup_teardown
@ -127,7 +127,7 @@ class RepetitiveRestart(TestLoadBase):
try:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
except AssertionError:
logger.debug("Test failed from first probe,"
@ -136,7 +136,7 @@ class RepetitiveRestart(TestLoadBase):
time.sleep(180)
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
self.show_step(12)
# LB 1519018

View File

@ -15,7 +15,7 @@ import time
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test import logger
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import ostf_test_mapping
from fuelweb_test.settings import DEPLOYMENT_MODE
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
@ -68,7 +68,7 @@ class CephRestart(TestBasic):
try:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
except AssertionError:
logger.debug("Test failed from first probe,"
@ -77,7 +77,7 @@ class CephRestart(TestBasic):
time.sleep(60)
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
self.fuel_web.run_ostf(cluster_id=cluster_id)
@ -183,7 +183,7 @@ class CephRestart(TestBasic):
try:
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
except AssertionError:
logger.debug("Test failed from first probe,"
@ -192,7 +192,7 @@ class CephRestart(TestBasic):
time.sleep(180)
self.fuel_web.run_single_ostf_test(
cluster_id, test_sets=['smoke'],
test_name=map_ostf.OSTF_TEST_MAPPING.get(
test_name=ostf_test_mapping.OSTF_TEST_MAPPING.get(
'Create volume and attach it to instance'))
self.fuel_web.run_ostf(cluster_id=cluster_id, should_fail=1)

View File

@ -19,7 +19,7 @@ from proboscis.asserts import assert_true
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers.utils import TimeStat
from fuelweb_test import settings as test_settings
from fuelweb_test import settings
from system_test import logger
from system_test import action
@ -110,8 +110,8 @@ class PrepareActions(object):
self.fuel_web.get_nailgun_version()
self.fuel_web.change_default_network_settings()
if (test_settings.REPLACE_DEFAULT_REPOS and
test_settings.REPLACE_DEFAULT_REPOS_ONLY_ONCE):
if (settings.REPLACE_DEFAULT_REPOS and
settings.REPLACE_DEFAULT_REPOS_ONLY_ONCE):
self.fuel_web.replace_default_repos()
self.env.make_snapshot("ready", is_make=True)
@ -233,7 +233,7 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
logger.info("Create env {}".format(
self.env_config['name']))
settings = {
cluster_settings = {
"murano": self.env_settings['components'].get('murano', False),
"sahara": self.env_settings['components'].get('sahara', False),
"ceilometer": self.env_settings['components'].get('ceilometer',
@ -271,9 +271,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
self.cluster_id = self.fuel_web.create_cluster(
name=self.env_config['name'],
mode=test_settings.DEPLOYMENT_MODE,
mode=settings.DEPLOYMENT_MODE,
release_name=self.env_config['release'],
settings=settings)
settings=cluster_settings)
logger.info("Cluster created with ID:{}".format(self.cluster_id))