Initial Oslo sync for Tempest.

This patch syncs cfg, iniparser, and setup from oslo.
Additionally, to avoid a name conflict tempest.openstack was
renamed tempest.clients.

Also, the duplicate copy of setup.py in tempest.common was removed
and all references to it were updated.

Change-Id: I6ed3a97e35ce73b820f7a436214480051ed6528f
This commit is contained in:
Matthew Treinish 2012-12-20 17:16:01 -05:00
parent 8dc9cfee12
commit 481466b8ba
34 changed files with 2003 additions and 79 deletions

7
openstack-common.conf Normal file
View File

@ -0,0 +1,7 @@
[DEFAULT]
# The list of modules to copy from openstack-common
modules=setup,cfg,iniparser
# The base module to hold the copy of openstack.common
base=tempest

View File

@ -19,10 +19,10 @@
import setuptools
from tempest.common import setup
from tempest.openstack.common import setup as common_setup
requires = setup.parse_requirements()
depend_links = setup.parse_dependency_links()
requires = common_setup.parse_requirements()
depend_links = common_setup.parse_dependency_links()
setuptools.setup(name='tempest',
version="2012.2",
@ -40,7 +40,7 @@ setuptools.setup(name='tempest',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7', ],
cmdclass=setup.get_cmdclass(),
cmdclass=common_setup.get_cmdclass(),
packages=setuptools.find_packages(exclude=['bin']),
install_requires=requires,
dependency_links=depend_links,

View File

@ -17,14 +17,14 @@ sleep times"""
from stress.test_servers import *
from stress.basher import BasherAction
from stress.driver import *
from tempest import openstack
from tempest import clients
choice_spec = [
BasherAction(TestCreateVM(), 50),
BasherAction(TestKillActiveVM(), 50)
]
nova = openstack.Manager()
nova = clients.Manager()
bash_openstack(nova,
choice_spec,

View File

@ -16,14 +16,14 @@
from stress.basher import BasherAction
from stress.driver import *
from stress.test_floating_ips import TestChangeFloatingIp
from tempest import openstack
from tempest import clients
choice_spec = [
BasherAction(TestChangeFloatingIp(), 100)
]
nova = openstack.Manager()
nova = clients.Manager()
bash_openstack(nova,
choice_spec,

View File

@ -18,7 +18,7 @@ from stress.test_servers import *
from stress.test_server_actions import *
from stress.basher import BasherAction
from stress.driver import *
from tempest import openstack
from tempest import clients
choice_spec = [
BasherAction(TestCreateVM(), 50),
@ -26,7 +26,7 @@ choice_spec = [
kargs={'type': 'HARD'})
]
nova = openstack.Manager()
nova = clients.Manager()
bash_openstack(nova,
choice_spec,

View File

@ -18,7 +18,7 @@ destroys them"""
from stress.test_servers import *
from stress.basher import BasherAction
from stress.driver import *
from tempest import openstack
from tempest import clients
choice_spec = [
BasherAction(TestCreateVM(), 50,
@ -27,7 +27,7 @@ choice_spec = [
]
nova = openstack.Manager()
nova = clients.Manager()
bash_openstack(nova,
choice_spec,

View File

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
#
# 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.
class ParseError(Exception):
def __init__(self, message, lineno, line):
self.msg = message
self.line = line
self.lineno = lineno
def __str__(self):
return 'at line %d, %s: %r' % (self.lineno, self.msg, self.line)
class BaseParser(object):
lineno = 0
parse_exc = ParseError
def _assignment(self, key, value):
self.assignment(key, value)
return None, []
def _get_section(self, line):
if line[-1] != ']':
return self.error_no_section_end_bracket(line)
if len(line) <= 2:
return self.error_no_section_name(line)
return line[1:-1]
def _split_key_value(self, line):
colon = line.find(':')
equal = line.find('=')
if colon < 0 and equal < 0:
return self.error_invalid_assignment(line)
if colon < 0 or (equal >= 0 and equal < colon):
key, value = line[:equal], line[equal + 1:]
else:
key, value = line[:colon], line[colon + 1:]
value = value.strip()
if ((value and value[0] == value[-1]) and
(value[0] == "\"" or value[0] == "'")):
value = value[1:-1]
return key.strip(), [value]
def parse(self, lineiter):
key = None
value = []
for line in lineiter:
self.lineno += 1
line = line.rstrip()
if not line:
# Blank line, ends multi-line values
if key:
key, value = self._assignment(key, value)
continue
elif line[0] in (' ', '\t'):
# Continuation of previous assignment
if key is None:
self.error_unexpected_continuation(line)
else:
value.append(line.lstrip())
continue
if key:
# Flush previous assignment, if any
key, value = self._assignment(key, value)
if line[0] == '[':
# Section start
section = self._get_section(line)
if section:
self.new_section(section)
elif line[0] in '#;':
self.comment(line[1:].lstrip())
else:
key, value = self._split_key_value(line)
if not key:
return self.error_empty_key(line)
if key:
# Flush previous assignment, if any
self._assignment(key, value)
def assignment(self, key, value):
"""Called when a full assignment is parsed"""
raise NotImplementedError()
def new_section(self, section):
"""Called when a new section is started"""
raise NotImplementedError()
def comment(self, comment):
"""Called when a comment is parsed"""
pass
def error_invalid_assignment(self, line):
raise self.parse_exc("No ':' or '=' found in assignment",
self.lineno, line)
def error_empty_key(self, line):
raise self.parse_exc('Key cannot be empty', self.lineno, line)
def error_unexpected_continuation(self, line):
raise self.parse_exc('Unexpected continuation line',
self.lineno, line)
def error_no_section_end_bracket(self, line):
raise self.parse_exc('Invalid section (must end with ])',
self.lineno, line)
def error_no_section_name(self, line):
raise self.parse_exc('Empty section name', self.lineno, line)

View File

@ -23,9 +23,9 @@ import urlparse
import boto.exception
import keystoneclient.exceptions
import tempest.clients
from tempest.common.utils.file_utils import have_effective_read_access
import tempest.config
import tempest.openstack
A_I_IMAGES_READY = False # ari,ami,aki
S3_CAN_CONNECT_ERROR = "Unknown Error"
@ -59,7 +59,7 @@ def setup_package():
if not secret_matcher.match(connection_data["aws_secret_access_key"]):
raise Exception("Invalid AWS secret Key")
raise Exception("Unknown (Authentication?) Error")
openstack = tempest.openstack.Manager()
openstack = tempest.clients.Manager()
try:
if urlparse.urlparse(config.boto.ec2_url).hostname is None:
raise Exception("Failed to get hostname from the ec2_url")

View File

@ -23,10 +23,10 @@ import nose
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest.exceptions import EC2RegisterImageException
from tempest import openstack
from tempest.testboto import BotoTestCase
import tempest.tests.boto
from tempest.tests.boto.utils.s3 import s3_upload_dir
@ -45,7 +45,7 @@ class InstanceRunTest(BotoTestCase):
if not tempest.tests.boto.A_I_IMAGES_READY:
raise nose.SkipTest("".join(("EC2 ", cls.__name__,
": requires ami/aki/ari manifest")))
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.s3_client = cls.os.s3_client
cls.ec2_client = cls.os.ec2api_client
config = cls.os.config

View File

@ -18,8 +18,8 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
from tempest.testboto import BotoTestCase
@ -34,7 +34,7 @@ class EC2KeysTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2KeysTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.ec2api_client
@attr(type='smoke')

View File

@ -18,7 +18,7 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import openstack
from tempest import clients
from tempest.testboto import BotoTestCase
@ -28,7 +28,7 @@ class EC2NetworkTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2NetworkTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.ec2api_client
#Note(afazekas): these tests for things duable without an instance

View File

@ -18,8 +18,8 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
from tempest.testboto import BotoTestCase
@ -29,7 +29,7 @@ class EC2SecurityGroupTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2SecurityGroupTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.ec2api_client
@attr(type='smoke')

View File

@ -21,7 +21,7 @@ import time
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import openstack
from tempest import clients
from tempest.testboto import BotoTestCase
LOG = logging.getLogger(__name__)
@ -38,7 +38,7 @@ class EC2VolumesTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2VolumesTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.ec2api_client
cls.zone = cls.client.get_good_zone()

View File

@ -18,8 +18,8 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
from tempest.testboto import BotoTestCase
@ -29,7 +29,7 @@ class S3BucketsTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(S3BucketsTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.s3_client
cls.config = cls.os.config

View File

@ -23,8 +23,8 @@ import nose
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
from tempest.testboto import BotoTestCase
import tempest.tests.boto
from tempest.tests.boto.utils.s3 import s3_upload_dir
@ -40,7 +40,7 @@ class S3ImagesTest(BotoTestCase):
if not tempest.tests.boto.A_I_IMAGES_READY:
raise nose.SkipTest("".join(("EC2 ", cls.__name__,
": requires ami/aki/ari manifest")))
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.s3_client = cls.os.s3_client
cls.images_client = cls.os.ec2api_client
config = cls.os.config

View File

@ -21,8 +21,8 @@ from boto.s3.key import Key
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
from tempest.testboto import BotoTestCase
from tempest.tests import boto
@ -33,7 +33,7 @@ class S3BucketsTest(BotoTestCase):
@classmethod
def setUpClass(cls):
super(S3BucketsTest, cls).setUpClass()
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.client = cls.os.s3_client
cls.config = cls.os.config

View File

@ -19,8 +19,8 @@ import logging
import nose
from tempest import clients
from tempest import config
from tempest import openstack
LOG = logging.getLogger(__name__)
@ -40,7 +40,7 @@ def setup_package():
LOG.debug("Entering tempest.tests.compute.setup_package")
global MULTI_USER, DISK_CONFIG_ENABLED, FLAVOR_EXTRA_DATA_ENABLED
os = openstack.Manager()
os = clients.Manager()
images_client = os.images_client
flavors_client = os.flavors_client
extensions_client = os.extensions_client

View File

@ -21,10 +21,10 @@ import time
import nose
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import config
from tempest import exceptions
from tempest import openstack
__all__ = ['BaseComputeTest', 'BaseComputeTestJSON', 'BaseComputeTestXML',
'BaseComputeAdminTestJSON', 'BaseComputeAdminTestXML']
@ -44,12 +44,12 @@ class BaseCompTest(unittest.TestCase):
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
os = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name,
interface=cls._interface)
os = clients.Manager(username=username,
password=password,
tenant_name=tenant_name,
interface=cls._interface)
else:
os = openstack.Manager(interface=cls._interface)
os = clients.Manager(interface=cls._interface)
cls.os = os
cls.servers_client = os.servers_client
@ -78,7 +78,7 @@ class BaseCompTest(unittest.TestCase):
"""
Returns an instance of the Identity Admin API client
"""
os = openstack.IdentityManager(interface=cls._interface)
os = clients.IdentityManager(interface=cls._interface)
admin_client = os.admin_client
return admin_client
@ -260,7 +260,7 @@ class BaseComputeAdminTest(unittest.TestCase):
"in configuration.")
raise nose.SkipTest(msg)
cls.os = openstack.AdminManager(interface=cls._interface)
cls.os = clients.AdminManager(interface=cls._interface)
class BaseComputeAdminTestJSON(BaseComputeAdminTest):

View File

@ -18,9 +18,9 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest import openstack
from tempest.tests.compute import base

View File

@ -19,11 +19,11 @@ import nose
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
import tempest.config
from tempest import exceptions
from tempest import openstack
from tempest.tests import compute
from tempest.tests.compute import base
@ -391,12 +391,12 @@ class ImagesTestJSON(base.BaseComputeTestJSON,
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
cls.alt_manager = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name)
cls.alt_manager = clients.Manager(username=username,
password=password,
tenant_name=tenant_name)
else:
# Use the alt_XXX credentials in the config file
cls.alt_manager = openstack.AltManager()
cls.alt_manager = clients.AltManager()
cls.alt_client = cls.alt_manager.images_client
@ -418,10 +418,10 @@ class ImagesTestXML(base.BaseComputeTestXML,
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
cls.alt_manager = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name)
cls.alt_manager = clients.Manager(username=username,
password=password,
tenant_name=tenant_name)
else:
# Use the alt_XXX credentials in the config file
cls.alt_manager = openstack.AltManager()
cls.alt_manager = clients.AltManager()
cls.alt_client = cls.alt_manager.images_client

View File

@ -21,9 +21,9 @@ import sys
import nose
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest import openstack
from tempest.tests import compute
from tempest.tests.compute.base import BaseComputeTest
@ -40,12 +40,12 @@ class ListServersNegativeTest(BaseComputeTest):
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
cls.alt_manager = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name)
cls.alt_manager = clients.Manager(username=username,
password=password,
tenant_name=tenant_name)
else:
# Use the alt_XXX credentials in the config file
cls.alt_manager = openstack.AltManager()
cls.alt_manager = clients.AltManager()
cls.alt_client = cls.alt_manager.servers_client
# Under circumstances when there is not a tenant/user

View File

@ -21,9 +21,9 @@ import nose
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest import openstack
from tempest.tests.compute.base import BaseComputeTest
@ -35,7 +35,7 @@ class ServersNegativeTest(BaseComputeTest):
super(ServersNegativeTest, cls).setUpClass()
cls.client = cls.servers_client
cls.img_client = cls.images_client
cls.alt_os = openstack.AltManager()
cls.alt_os = clients.AltManager()
cls.alt_client = cls.alt_os.servers_client
@attr(type='negative')

View File

@ -20,10 +20,10 @@ from nose import SkipTest
from nose.tools import raises
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest import openstack
from tempest.tests import compute
from tempest.tests.compute.base import BaseComputeTest
@ -47,12 +47,12 @@ class AuthorizationTest(BaseComputeTest):
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
cls.alt_manager = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name)
cls.alt_manager = clients.Manager(username=username,
password=password,
tenant_name=tenant_name)
else:
# Use the alt_XXX credentials in the config file
cls.alt_manager = openstack.AltManager()
cls.alt_manager = clients.AltManager()
cls.alt_client = cls.alt_manager.servers_client
cls.alt_images_client = cls.alt_manager.images_client

View File

@ -18,10 +18,10 @@
from nose.plugins.attrib import attr
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils.linux.remote_client import RemoteClient
import tempest.config
from tempest import openstack
from tempest.tests.compute import base

View File

@ -18,15 +18,15 @@
import nose
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import openstack
class BaseIdAdminTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
os = openstack.IdentityManager(interface=cls._interface)
os = clients.IdentityManager(interface=cls._interface)
cls.client = os.admin_client
cls.token_client = os.token_client
@ -35,7 +35,7 @@ class BaseIdAdminTest(unittest.TestCase):
cls.data = DataGenerator(cls.client)
os = openstack.IdentityNaManager(interface=cls._interface)
os = clients.IdentityNaManager(interface=cls._interface)
cls.non_admin_client = os.admin_client
@classmethod

View File

@ -30,7 +30,7 @@ try:
except ImportError:
pass
from tempest import openstack
from tempest import clients
class CreateRegisterImagesTest(unittest.TestCase):
@ -43,7 +43,7 @@ class CreateRegisterImagesTest(unittest.TestCase):
def setUpClass(cls):
if not GLANCE_INSTALLED:
raise SkipTest('Glance not installed')
cls.os = openstack.ServiceManager()
cls.os = clients.ServiceManager()
cls.client = cls.os.images.get_client()
cls.created_images = []
@ -138,7 +138,7 @@ class ListImagesTest(unittest.TestCase):
def setUpClass(cls):
if not GLANCE_INSTALLED:
raise SkipTest('Glance not installed')
cls.os = openstack.ServiceManager()
cls.os = clients.ServiceManager()
cls.client = cls.os.images.get_client()
cls.created_images = []

View File

@ -18,16 +18,16 @@
import nose
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest import openstack
class BaseNetworkTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
os = openstack.Manager()
os = clients.Manager()
client = os.network_client
config = os.config
networks = []

View File

@ -18,16 +18,16 @@
import nose
import unittest2 as unittest
from tempest import clients
import tempest.config
from tempest import exceptions
from tempest import openstack
class BaseObjectTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.os = openstack.Manager()
cls.os = clients.Manager()
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client

View File

@ -21,10 +21,10 @@ import time
import nose
import unittest2 as unittest
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import config
from tempest import exceptions
from tempest import openstack
LOG = logging.getLogger(__name__)
@ -41,11 +41,11 @@ class BaseVolumeTest(unittest.TestCase):
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
username, tenant_name, password = creds
os = openstack.Manager(username=username,
password=password,
tenant_name=tenant_name)
os = clients.Manager(username=username,
password=password,
tenant_name=tenant_name)
else:
os = openstack.Manager()
os = clients.Manager()
cls.os = os
cls.volumes_client = os.volumes_client
@ -73,7 +73,7 @@ class BaseVolumeTest(unittest.TestCase):
"""
Returns an instance of the Identity Admin API client
"""
os = openstack.IdentityManager()
os = clients.IdentityManager()
return os.admin_client
@classmethod