Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
9 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |