diff --git a/README.rst b/README.rst index 3162642..1e3338b 100644 --- a/README.rst +++ b/README.rst @@ -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 location of the log files: - 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_ssh_user = "username for controller and log file nodes" - target_controller = "hostname or ip of controller node (for nova-manage) - log_check_interval = "time between checking logs for errors (default 60s)" + - 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_ssh_user = "username for controller and log file nodes" + - target_controller = "hostname or ip of controller node (for nova-manage) + - 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` 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 ------------------------------- +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 ************* + 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 later one is being used to define all config options specific to stress tests. -Run: -**** -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: +.. _configuration: http://docs.openstack.org/developer/tempest/configuration.html#tempest-configuration - 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. +For more information please refer run-tempest-stress CLI help:: + + $ run-tempest-stress -h Additional Tools ---------------- diff --git a/requirements.txt b/requirements.txt index 0515bcd..2f8b3e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,7 @@ pbr>=1.6 # Apache-2.0 Babel>=1.3 +oslo.config>=3.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 diff --git a/setup.py b/setup.py index 4b34a0a..056c16c 100644 --- a/setup.py +++ b/setup.py @@ -26,4 +26,4 @@ except ImportError: setuptools.setup( setup_requires=['pbr'], - pbr=True) \ No newline at end of file + pbr=True) diff --git a/tempest_stress/actions/server_create_destroy.py b/tempest_stress/actions/server_create_destroy.py index 22d088b..ce82d5c 100644 --- a/tempest_stress/actions/server_create_destroy.py +++ b/tempest_stress/actions/server_create_destroy.py @@ -15,6 +15,7 @@ from tempest.common.utils import data_utils from tempest.common import waiters from tempest import config + import tempest_stress.stressaction as stressaction CONF = config.CONF diff --git a/tempest_stress/actions/ssh_floating.py b/tempest_stress/actions/ssh_floating.py index c6bd35a..8d654ce 100644 --- a/tempest_stress/actions/ssh_floating.py +++ b/tempest_stress/actions/ssh_floating.py @@ -17,6 +17,7 @@ from tempest.common.utils import data_utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import test_utils + import tempest_stress.stressaction as stressaction CONF = config.CONF diff --git a/tempest_stress/actions/unit_test.py b/tempest_stress/actions/unit_test.py index 46c4d07..3a9efd0 100644 --- a/tempest_stress/actions/unit_test.py +++ b/tempest_stress/actions/unit_test.py @@ -12,8 +12,8 @@ from oslo_log import log as logging from oslo_utils import importutils - from tempest import config + import tempest_stress.stressaction as stressaction CONF = config.CONF @@ -74,7 +74,7 @@ class UnitTest(stressaction.StressAction): def run(self): if self.class_setup_per != SetUpClassRunTime.application: if (self.class_setup_per == SetUpClassRunTime.action - or self.setupclass_called is False): + or self.setupclass_called is False): self.klass.setUpClass() self.setupclass_called = True @@ -82,7 +82,7 @@ class UnitTest(stressaction.StressAction): self.run_core() finally: 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() else: self.run_core() diff --git a/tempest_stress/actions/volume_attach_delete.py b/tempest_stress/actions/volume_attach_delete.py index 2307885..f3919fc 100644 --- a/tempest_stress/actions/volume_attach_delete.py +++ b/tempest_stress/actions/volume_attach_delete.py @@ -14,6 +14,7 @@ from tempest.common.utils import data_utils from tempest.common import waiters from tempest import config + import tempest_stress.stressaction as stressaction CONF = config.CONF diff --git a/tempest_stress/actions/volume_attach_verify.py b/tempest_stress/actions/volume_attach_verify.py index 444920d..06d6035 100644 --- a/tempest_stress/actions/volume_attach_verify.py +++ b/tempest_stress/actions/volume_attach_verify.py @@ -17,6 +17,7 @@ from tempest.common.utils.linux import remote_client from tempest.common import waiters from tempest import config from tempest.lib.common.utils import test_utils + import tempest_stress.stressaction as stressaction CONF = config.CONF diff --git a/tempest_stress/actions/volume_create_delete.py b/tempest_stress/actions/volume_create_delete.py index ea75418..2ec3115 100644 --- a/tempest_stress/actions/volume_create_delete.py +++ b/tempest_stress/actions/volume_create_delete.py @@ -12,6 +12,7 @@ from tempest.common.utils import data_utils from tempest import config + import tempest_stress.stressaction as stressaction CONF = config.CONF diff --git a/tempest_stress/cleanup.py b/tempest_stress/cleanup.py index 3b0a937..e8c9fed 100644 --- a/tempest_stress/cleanup.py +++ b/tempest_stress/cleanup.py @@ -15,7 +15,6 @@ # limitations under the License. from oslo_log import log as logging - from tempest.common import credentials_factory as credentials from tempest.common import waiters diff --git a/tempest_stress/cmd/run_stress.py b/tempest_stress/cmd/run_stress.py index 0d3b636..5c35024 100755 --- a/tempest_stress/cmd/run_stress.py +++ b/tempest_stress/cmd/run_stress.py @@ -25,8 +25,8 @@ except ImportError: from unittest2 import loader from oslo_log import log as logging -from testtools import testsuite from tempest import config +from testtools import testsuite from tempest_stress import config as stress_cfg from tempest_stress import driver @@ -35,8 +35,8 @@ LOG = logging.getLogger(__name__) 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") tests = [] testloader = loader.TestLoader() @@ -65,7 +65,7 @@ def discover_stress_tests(path="./", filter_attr=None, call_inherited=False): } } 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) if test_func.__name__ not in class_structure[0].__dict__: continue @@ -75,8 +75,8 @@ def discover_stress_tests(path="./", filter_attr=None, call_inherited=False): parser = argparse.ArgumentParser(description='Run stress tests') parser.add_argument('-c', '--config-file-path', - metavar='/etc/', - help='path to tempest and stress tests config files') + metavar='/etc/tempest', + help='path to tempest and stress tests config files') parser.add_argument('-d', '--duration', default=300, type=int, help="Duration of test in secs") parser.add_argument('-s', '--serial', action='store_true', diff --git a/tempest_stress/config.py b/tempest_stress/config.py index 5ca21ca..b7cfed5 100644 --- a/tempest_stress/config.py +++ b/tempest_stress/config.py @@ -57,6 +57,7 @@ StressGroup = [ ' every project.') ] + class StressConfigPrivate(object): DEFAULT_CONFIG_FILE = "stress_tests.conf" @@ -66,7 +67,8 @@ class StressConfigPrivate(object): super(StressConfigPrivate, self).__init__() # 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 = '' if config_path: config_path + '/' + self.DEFAULT_CONFIG_FILE @@ -93,6 +95,7 @@ class StressConfigPrivate(object): class StressConfigProxy(object): _config = None _path = None + def __getattr__(self, attr): if not self._config: self._config = StressConfigPrivate(config_path=self._path) diff --git a/tempest_stress/etc/sample-unit-test.json b/tempest_stress/etc/sample-unit-test.json index 20bdcbd..26a076e 100644 --- a/tempest_stress/etc/sample-unit-test.json +++ b/tempest_stress/etc/sample-unit-test.json @@ -2,7 +2,7 @@ "threads": 8, "use_admin": 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"} } ] diff --git a/tempest_stress/stressaction.py b/tempest_stress/stressaction.py index cf0a08a..ce7aec0 100644 --- a/tempest_stress/stressaction.py +++ b/tempest_stress/stressaction.py @@ -16,9 +16,8 @@ import abc import signal import sys -import six - from oslo_log import log as logging +import six @six.add_metaclass(abc.ABCMeta) diff --git a/tempest_stress/tests/stress/test_stressaction.py b/tempest_stress/tests/stress/test_stressaction.py index 946a864..948cc36 100644 --- a/tempest_stress/tests/stress/test_stressaction.py +++ b/tempest_stress/tests/stress/test_stressaction.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import tempest_stress.stressaction as stressaction import tempest.test +import tempest_stress.stressaction as stressaction + class FakeStressAction(stressaction.StressAction): def __init__(self, manager, max_runs=None, stop_on_error=False): diff --git a/test-requirements.txt b/test-requirements.txt index 757b1b9..86c11d0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,5 +10,4 @@ sphinx!=1.3b1,<1.3,>=1.2.1 # BSD oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT diff --git a/tox.ini b/tox.ini index e70934b..9bccea1 100644 --- a/tox.ini +++ b/tox.ini @@ -13,13 +13,12 @@ commands = python setup.py test --slowest --testr-args='{posargs}' [testenv:stress] envdir = .tox/tempest_stress -sitepackages = {[tempestenv]sitepackages} -setenv = {[tempestenv]setenv} -deps = {[tempestenv]deps} +sitepackages = False commands = run-tempest-stress {posargs} [testenv:pep8] +sitepackages = False commands = flake8 {posargs} [testenv:venv]