Stress improts

* Partial relative import fix
* Wildcard imports removed
* stress/utils/util.py renamed to stress/utils.py
* time/datetime module aliasing removed

Change-Id: Ib0b234581695604c10c51915210e4643a8732874
This commit is contained in:
Attila Fazekas 2013-02-16 16:41:03 +01:00
parent b2902af858
commit 73c152d268
10 changed files with 27 additions and 37 deletions

View File

@ -24,9 +24,10 @@ from state import ClusterState
from state import FloatingIpState
from state import KeyPairState
from state import VolumeState
from test_case import *
import stress.utils
from test_case import logging
from tempest.common.utils.data_utils import rand_name
import utils.util
# setup logging to file
logging.basicConfig(
@ -73,7 +74,7 @@ def _get_compute_nodes(keypath, user, controller):
if keypath is None or user is None:
return nodes
cmd = "nova-manage service list | grep ^nova-compute"
lines = utils.util.ssh(keypath, user, controller, cmd).split('\n')
lines = stress.utils.ssh(keypath, user, controller, cmd).split('\n')
# For example: nova-compute xg11eth0 nova enabled :-) 2011-10-31 18:57:46
# This is fragile but there is, at present, no other way to get this info.
for line in lines:
@ -89,7 +90,7 @@ def _error_in_logs(keypath, logdir, user, nodes):
"""
grep = 'egrep "ERROR\|TRACE" %s/*.log' % logdir
for node in nodes:
errors = utils.util.ssh(keypath, user, node, grep, check=False)
errors = stress.utils.ssh(keypath, user, node, grep, check=False)
if len(errors) > 0:
logging.error('%s: %s' % (node, errors))
return True
@ -173,8 +174,8 @@ def bash_openstack(manager,
user = stress_config.host_admin_user
logdir = stress_config.nova_logdir
computes = _get_compute_nodes(keypath, user, manager.config.identity.host)
utils.util.execute_on_all(keypath, user, computes,
"rm -f %s/*.log" % logdir)
stress.utils.execute_on_all(keypath, user, computes,
"rm -f %s/*.log" % logdir)
random.seed(seed)
cases = _create_cases(choice_spec)
state = ClusterState(max_vms=max_vms)

View File

@ -14,7 +14,6 @@
import random
import telnetlib
import time
import pending_action
import test_case

View File

@ -18,12 +18,11 @@ sub-class will have a corresponding PendingServerAction. These pending
actions veriy that the API call was successful or not."""
import random
import time
import pending_action
import stress.utils
from tempest.exceptions import Duplicate
import test_case
from utils.util import *
class TestRebootVM(test_case.StressTestCase):
@ -81,7 +80,7 @@ class TestRebootVM(test_case.StressTestCase):
class VerifyRebootVM(pending_action.PendingServerAction):
"""Class to verify that the reboot completed."""
States = enum('REBOOT_CHECK', 'ACTIVE_CHECK')
States = stress.utils.enum('REBOOT_CHECK', 'ACTIVE_CHECK')
def __init__(self, manager, state, target_server,
reboot_state=None,

View File

@ -18,7 +18,6 @@ Each sub-class will have a corresponding PendingServerAction. These pending
actions veriy that the API call was successful or not."""
import random
import time
import pending_action
import test_case
@ -39,7 +38,6 @@ class TestCreateVM(test_case.StressTestCase):
`pargs` : positional arguments
`kwargs` : keyword arguments, which include:
`key_name` : name of keypair
`timeout` : how long to wait before issuing Exception
`image_ref` : index to image types availablexs
`flavor_ref`: index to flavor types available
(default = 1, which is tiny)
@ -52,8 +50,6 @@ class TestCreateVM(test_case.StressTestCase):
return None
_key_name = kwargs.get('key_name', '')
_timeout = int(kwargs.get('timeout',
manager.config.compute.build_timeout))
_image_ref = kwargs.get('image_ref', manager.config.compute.image_ref)
_flavor_ref = kwargs.get('flavor_ref',
manager.config.compute.flavor_ref)

View File

@ -14,9 +14,13 @@
"""More aggressive test that creates and destroys VMs with shorter
sleep times"""
from stress.test_servers import *
import datetime
import time
from stress.basher import BasherAction
from stress.driver import *
from stress.driver import bash_openstack
from stress.test_servers import TestCreateVM
from stress.test_servers import TestKillActiveVM
from tempest import clients
choice_spec = [

View File

@ -13,8 +13,10 @@
# limitations under the License.
"""Stress test that associates/disasssociates floating ips."""
import datetime
from stress.basher import BasherAction
from stress.driver import *
from stress.driver import bash_openstack
from stress.test_floating_ips import TestChangeFloatingIp
from tempest import clients

View File

@ -13,11 +13,13 @@
# limitations under the License.
"""Test that reboots random instances in a Nova cluster."""
import datetime
import time
from stress.test_servers import *
from stress.test_server_actions import *
from stress.basher import BasherAction
from stress.driver import *
from stress.driver import bash_openstack
from stress.test_server_actions import TestRebootVM
from stress.test_servers import TestCreateVM
from tempest import clients
choice_spec = [

View File

@ -14,10 +14,12 @@
"""Sample stress test that creates a few virtual machines and then
destroys them"""
import datetime
from stress.test_servers import *
from stress.basher import BasherAction
from stress.driver import *
from stress.driver import bash_openstack
from stress.test_servers import TestCreateVM
from stress.test_servers import TestKillActiveVM
from tempest import clients
choice_spec = [

View File

@ -1,15 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Quanta Research Cambridge, 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.