Adds basic Marconi test

This patch adds the config options needed to add Queuing tests.
This patch also has a basic test to verify that everything works
as expected.

Change-Id: I0769affe66a1e94bff366305e230c1b388e68278
Implements: blueprint add-basic-marconi-tests
This commit is contained in:
Malini Kamalambal 2014-02-06 06:49:04 -05:00
parent b91ecd0298
commit 6e7b3b8f13
9 changed files with 174 additions and 0 deletions

View File

@ -712,6 +712,16 @@
#max_template_size=524288
[queuing]
#
# Options defined in tempest.config
#
# Catalog type of the Queuing service. (string value)
#catalog_type=queuing
[scenario]
#
@ -791,6 +801,10 @@
# value)
#trove=false
# Whether or not Marconi is expected to be available (boolean
# value)
#marconi=false
[stress]

View File

View File

@ -0,0 +1,49 @@
# Copyright (c) 2014 Rackspace, 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.
from tempest import config
from tempest.openstack.common import log as logging
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
class BaseQueuingTest(test.BaseTestCase):
"""
Base class for the Queuing tests that use the Tempest Marconi REST client
It is assumed that the following option is defined in the
[service_available] section of etc/tempest.conf
queuing as True
"""
@classmethod
def setUpClass(cls):
super(BaseQueuingTest, cls).setUpClass()
if not CONF.service_available.marconi:
raise cls.skipException("Marconi support is required")
os = cls.get_client_manager()
cls.queuing_cfg = CONF.queuing
cls.client = os.queuing_client
@classmethod
def create_queue(cls, queue_name):
"""Wrapper utility that returns a test queue."""
resp, body = cls.client.create_queue(queue_name)
return resp, body

View File

@ -0,0 +1,37 @@
# Copyright (c) 2014 Rackspace, 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 logging
from tempest.api.queuing import base
from tempest.common.utils import data_utils
from tempest import test
LOG = logging.getLogger(__name__)
class TestQueues(base.BaseQueuingTest):
@test.attr(type='smoke')
def test_create_queue(self):
# Create Queue
queue_name = data_utils.rand_name('test-')
resp, body = self.create_queue(queue_name)
self.addCleanup(self.client.delete_queue, queue_name)
self.assertEqual('201', resp['status'])
self.assertEqual('', body)

View File

@ -152,6 +152,7 @@ from tempest.services.object_storage.object_client import \
ObjectClientCustomizedHeader
from tempest.services.orchestration.json.orchestration_client import \
OrchestrationClient
from tempest.services.queuing.json.queuing_client import QueuingClientJSON
from tempest.services.telemetry.json.telemetry_client import \
TelemetryClientJSON
from tempest.services.telemetry.xml.telemetry_client import \
@ -334,6 +335,7 @@ class Manager(manager.Manager):
self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
self.database_flavors_client = DatabaseFlavorsClientJSON(
self.auth_provider)
self.queuing_client = QueuingClientJSON(self.auth_provider)
if CONF.service_available.ceilometer:
self.telemetry_client = TelemetryClientJSON(
self.auth_provider)

View File

@ -381,6 +381,15 @@ NetworkFeaturesGroup = [
'entry all which indicates every extension is enabled'),
]
queuing_group = cfg.OptGroup(name='queuing',
title='Queuing Service')
QueuingGroup = [
cfg.StrOpt('catalog_type',
default='queuing',
help='Catalog type of the Queuing service.'),
]
volume_group = cfg.OptGroup(name='volume',
title='Block Storage Options')
@ -753,6 +762,9 @@ ServiceAvailableGroup = [
cfg.BoolOpt('trove',
default=False,
help="Whether or not Trove is expected to be available"),
cfg.BoolOpt('marconi',
default=False,
help="Whether or not Marconi is expected to be available"),
]
debug_group = cfg.OptGroup(name="debug",
@ -833,6 +845,7 @@ def register_opts():
register_opt_group(cfg.CONF, network_group, NetworkGroup)
register_opt_group(cfg.CONF, network_feature_group,
NetworkFeaturesGroup)
register_opt_group(cfg.CONF, queuing_group, QueuingGroup)
register_opt_group(cfg.CONF, volume_group, VolumeGroup)
register_opt_group(cfg.CONF, volume_feature_group,
VolumeFeaturesGroup)
@ -883,6 +896,7 @@ class TempestConfigPrivate(object):
'object-storage-feature-enabled']
self.database = cfg.CONF.database
self.orchestration = cfg.CONF.orchestration
self.queuing = cfg.CONF.queuing
self.telemetry = cfg.CONF.telemetry
self.dashboard = cfg.CONF.dashboard
self.data_processing = cfg.CONF.data_processing

View File

View File

@ -0,0 +1,58 @@
# Copyright (c) 2014 Rackspace, 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 json
from tempest.common import rest_client
from tempest import config
CONF = config.CONF
class QueuingClientJSON(rest_client.RestClient):
def __init__(self, auth_provider):
super(QueuingClientJSON, self).__init__(auth_provider)
self.service = CONF.queuing.catalog_type
self.version = '1'
self.uri_prefix = 'v{0}'.format(self.version)
def list_queues(self):
uri = '{0}/queues'.format(self.uri_prefix)
resp, body = self.get(uri)
body = json.loads(body)
return resp, body
def create_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.put(uri, body=None)
return resp, body
def get_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
body = json.loads(body)
return resp, body
def head_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.head(uri)
body = json.loads(body)
return resp, body
def delete_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp = self.delete(uri)
return resp