Multiple fix: now running

This commit is contained in:
ghanshyam 2016-10-21 10:25:31 +09:00
parent df2232eebc
commit 04ab7c0dd4
17 changed files with 62 additions and 38 deletions

View File

@ -23,11 +23,11 @@ the private key and user name for ssh to the cluster in the
[stress] section of tempest.conf. You also need to provide the [stress] section of tempest.conf. You also need to provide the
location of the log files: location of the log files:
target_logfiles = "regexp to all log files to be checked for errors" - target_logfiles = "regexp to all log files to be checked for errors"
target_private_key_path = "private ssh key for controller and log file nodes" - target_private_key_path = "private ssh key for controller and log file nodes"
target_ssh_user = "username for controller and log file nodes" - target_ssh_user = "username for controller and log file nodes"
target_controller = "hostname or ip of controller node (for nova-manage) - target_controller = "hostname or ip of controller node (for nova-manage)
log_check_interval = "time between checking logs for errors (default 60s)" - log_check_interval = "time between checking logs for errors (default 60s)"
To activate logging on your console please make sure that you activate `use_stderr` To activate logging on your console please make sure that you activate `use_stderr`
in tempest.conf or use the default `logging.conf.sample` file. in tempest.conf or use the default `logging.conf.sample` file.
@ -35,34 +35,51 @@ in tempest.conf or use the default `logging.conf.sample` file.
Running default stress test set Running default stress test set
------------------------------- -------------------------------
Installation
------------
#. You first need to clone this repo.::
$ git clone https://github.com/ghanshyammann/tempest_stress
$ cd tempest_stress
#. Intall::
$ python setup.py install
#. Install `Tempest`_
.. _Tempest: http://docs.openstack.org/developer/tempest/overview.html#quickstart
Configuration Configuration
************* *************
To Run stress tests, two configuration files are needed: To Run stress tests, two configuration files are needed:
1. tempest.conf - As per Tempest configuration guidlines 1. tempest.conf - As per Tempest configuration guidlines here: `configuration`_
2. stress_tests.conf - same location as tempest.conf 2. stress_tests.conf - same location as tempest.conf
later one is being used to define all config options specific to stress tests. later one is being used to define all config options specific to stress tests.
Run: .. _configuration: http://docs.openstack.org/developer/tempest/configuration.html#tempest-configuration
****
The stress test framework can automatically discover test inside the tempest
test suite. All test flag with the `@stresstest` decorator will be executed.
In order to use this discovery you have to install tempest CLI, be in the
tempest root directory and execute the following:
tempest run-stress -a -d 30
Running the sample test Run
----------------------- ***
To test installation, do the following: Run all tests::
tempest run-stress -t tempest/stress/etc/server-create-destroy-test.json -d 30 $ run-tempest-stress -a -d 30
Run specific test::
$ run-tempest-stress -t ./tempest_stress/etc/server-create-destroy-test.json -d 30
This sample test tries to create a few VMs and kill a few VMs. This sample test tries to create a few VMs and kill a few VMs.
For more information please refer run-tempest-stress CLI help::
$ run-tempest-stress -h
Additional Tools Additional Tools
---------------- ----------------

View File

@ -4,5 +4,7 @@
pbr>=1.6 # Apache-2.0 pbr>=1.6 # Apache-2.0
Babel>=1.3 Babel>=1.3
oslo.config>=3.14.0 # Apache-2.0
oslo.log>=1.14.0 # Apache-2.0 oslo.log>=1.14.0 # Apache-2.0
tempest>=13.0.0 tempest>=12.1.0 # Apache-2.0
unittest2 # BSD

View File

@ -26,4 +26,4 @@ except ImportError:
setuptools.setup( setuptools.setup(
setup_requires=['pbr'], setup_requires=['pbr'],
pbr=True) pbr=True)

View File

@ -15,6 +15,7 @@
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest.common import waiters from tempest.common import waiters
from tempest import config from tempest import config
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF

View File

@ -17,6 +17,7 @@ from tempest.common.utils import data_utils
from tempest.common import waiters from tempest.common import waiters
from tempest import config from tempest import config
from tempest.lib.common.utils import test_utils from tempest.lib.common.utils import test_utils
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF

View File

@ -12,8 +12,8 @@
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import importutils from oslo_utils import importutils
from tempest import config from tempest import config
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF
@ -74,7 +74,7 @@ class UnitTest(stressaction.StressAction):
def run(self): def run(self):
if self.class_setup_per != SetUpClassRunTime.application: if self.class_setup_per != SetUpClassRunTime.application:
if (self.class_setup_per == SetUpClassRunTime.action if (self.class_setup_per == SetUpClassRunTime.action
or self.setupclass_called is False): or self.setupclass_called is False):
self.klass.setUpClass() self.klass.setUpClass()
self.setupclass_called = True self.setupclass_called = True
@ -82,7 +82,7 @@ class UnitTest(stressaction.StressAction):
self.run_core() self.run_core()
finally: finally:
if (CONF.stress.leave_dirty_stack is False if (CONF.stress.leave_dirty_stack is False
and self.class_setup_per == SetUpClassRunTime.action): and self.class_setup_per == SetUpClassRunTime.action):
self.klass.tearDownClass() self.klass.tearDownClass()
else: else:
self.run_core() self.run_core()

View File

@ -14,6 +14,7 @@
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest.common import waiters from tempest.common import waiters
from tempest import config from tempest import config
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF

View File

@ -17,6 +17,7 @@ from tempest.common.utils.linux import remote_client
from tempest.common import waiters from tempest.common import waiters
from tempest import config from tempest import config
from tempest.lib.common.utils import test_utils from tempest.lib.common.utils import test_utils
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF

View File

@ -12,6 +12,7 @@
from tempest.common.utils import data_utils from tempest.common.utils import data_utils
from tempest import config from tempest import config
import tempest_stress.stressaction as stressaction import tempest_stress.stressaction as stressaction
CONF = config.CONF CONF = config.CONF

View File

@ -15,7 +15,6 @@
# limitations under the License. # limitations under the License.
from oslo_log import log as logging from oslo_log import log as logging
from tempest.common import credentials_factory as credentials from tempest.common import credentials_factory as credentials
from tempest.common import waiters from tempest.common import waiters

View File

@ -25,8 +25,8 @@ except ImportError:
from unittest2 import loader from unittest2 import loader
from oslo_log import log as logging from oslo_log import log as logging
from testtools import testsuite
from tempest import config from tempest import config
from testtools import testsuite
from tempest_stress import config as stress_cfg from tempest_stress import config as stress_cfg
from tempest_stress import driver from tempest_stress import driver
@ -35,8 +35,8 @@ LOG = logging.getLogger(__name__)
def discover_stress_tests(path="./", filter_attr=None, call_inherited=False): def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
"""Discovers all tests and create action out of them """Discovers all tests and create action out of them."""
"""
LOG.info("Start test discovery") LOG.info("Start test discovery")
tests = [] tests = []
testloader = loader.TestLoader() testloader = loader.TestLoader()
@ -65,7 +65,7 @@ def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
} }
} }
if (not call_inherited and if (not call_inherited and
getattr(test_func, "st_allow_inheritance") is not True): getattr(test_func, "st_allow_inheritance") is not True):
class_structure = inspect.getmro(test_func.im_class) class_structure = inspect.getmro(test_func.im_class)
if test_func.__name__ not in class_structure[0].__dict__: if test_func.__name__ not in class_structure[0].__dict__:
continue continue
@ -75,8 +75,8 @@ def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
parser = argparse.ArgumentParser(description='Run stress tests') parser = argparse.ArgumentParser(description='Run stress tests')
parser.add_argument('-c', '--config-file-path', parser.add_argument('-c', '--config-file-path',
metavar='/etc/', metavar='/etc/tempest',
help='path to tempest and stress tests config files') help='path to tempest and stress tests config files')
parser.add_argument('-d', '--duration', default=300, type=int, parser.add_argument('-d', '--duration', default=300, type=int,
help="Duration of test in secs") help="Duration of test in secs")
parser.add_argument('-s', '--serial', action='store_true', parser.add_argument('-s', '--serial', action='store_true',

View File

@ -57,6 +57,7 @@ StressGroup = [
' every project.') ' every project.')
] ]
class StressConfigPrivate(object): class StressConfigPrivate(object):
DEFAULT_CONFIG_FILE = "stress_tests.conf" DEFAULT_CONFIG_FILE = "stress_tests.conf"
@ -66,7 +67,8 @@ class StressConfigPrivate(object):
super(StressConfigPrivate, self).__init__() super(StressConfigPrivate, self).__init__()
# Environment variables override defaults. # Environment variables override defaults.
conf_file = os.environ.get('STRESS_TEST_CONFIG', self.DEFAULT_CONFIG_FILE) conf_file = os.environ.get('STRESS_TEST_CONFIG',
self.DEFAULT_CONFIG_FILE)
conf_path = '' conf_path = ''
if config_path: if config_path:
config_path + '/' + self.DEFAULT_CONFIG_FILE config_path + '/' + self.DEFAULT_CONFIG_FILE
@ -93,6 +95,7 @@ class StressConfigPrivate(object):
class StressConfigProxy(object): class StressConfigProxy(object):
_config = None _config = None
_path = None _path = None
def __getattr__(self, attr): def __getattr__(self, attr):
if not self._config: if not self._config:
self._config = StressConfigPrivate(config_path=self._path) self._config = StressConfigPrivate(config_path=self._path)

View File

@ -2,7 +2,7 @@
"threads": 8, "threads": 8,
"use_admin": true, "use_admin": true,
"use_isolated_tenants": true, "use_isolated_tenants": true,
"kwargs": {"test_method": "tempest.cli.simple_read_only.test_glance.SimpleReadOnlyGlanceClientTest.test_glance_fake_action", "kwargs": {"test_method": "tempest.scenario.test_network_advanced_server_ops.TestNetworkAdvancedServerOps.test_server_connectivity_stop_start"",
"class_setup_per": "process"} "class_setup_per": "process"}
} }
] ]

View File

@ -16,9 +16,8 @@ import abc
import signal import signal
import sys import sys
import six
from oslo_log import log as logging from oslo_log import log as logging
import six
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import tempest_stress.stressaction as stressaction
import tempest.test import tempest.test
import tempest_stress.stressaction as stressaction
class FakeStressAction(stressaction.StressAction): class FakeStressAction(stressaction.StressAction):
def __init__(self, manager, max_runs=None, stop_on_error=False): def __init__(self, manager, max_runs=None, stop_on_error=False):

View File

@ -10,5 +10,4 @@ sphinx!=1.3b1,<1.3,>=1.2.1 # BSD
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT

View File

@ -13,13 +13,12 @@ commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:stress] [testenv:stress]
envdir = .tox/tempest_stress envdir = .tox/tempest_stress
sitepackages = {[tempestenv]sitepackages} sitepackages = False
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
commands = commands =
run-tempest-stress {posargs} run-tempest-stress {posargs}
[testenv:pep8] [testenv:pep8]
sitepackages = False
commands = flake8 {posargs} commands = flake8 {posargs}
[testenv:venv] [testenv:venv]