Skip to content

Commit

Permalink
Adds basic Marconi test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Malini Kamalambal committed Mar 10, 2014
1 parent b91ecd0 commit 6e7b3b8
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 0 deletions.
14 changes: 14 additions & 0 deletions etc/tempest.conf.sample
Expand Up @@ -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]

#
Expand Down Expand Up @@ -791,6 +801,10 @@
# value)
#trove=false

# Whether or not Marconi is expected to be available (boolean
# value)
#marconi=false


[stress]

Expand Down
Empty file added tempest/api/queuing/__init__.py
Empty file.
49 changes: 49 additions & 0 deletions tempest/api/queuing/base.py
@@ -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
37 changes: 37 additions & 0 deletions tempest/api/queuing/test_queues.py
@@ -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)
2 changes: 2 additions & 0 deletions tempest/clients.py
Expand Up @@ -152,6 +152,7 @@
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 \
Expand Down Expand Up @@ -334,6 +335,7 @@ def __init__(self, username=None, password=None, tenant_name=None,
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)
Expand Down
14 changes: 14 additions & 0 deletions tempest/config.py
Expand Up @@ -381,6 +381,15 @@ def register_opt_group(conf, opt_group, options):
'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')

Expand Down Expand Up @@ -753,6 +762,9 @@ def register_opt_group(conf, opt_group, options):
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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -883,6 +896,7 @@ def _set_attrs(self):
'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
Expand Down
Empty file.
Empty file.
58 changes: 58 additions & 0 deletions tempest/services/queuing/json/queuing_client.py
@@ -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

0 comments on commit 6e7b3b8

Please sign in to comment.