Add initial code for tempest tests
This is a bit of initial structure for some Tempest tests intended to run in the devstack gates. * Contains a single test case (list zones) * Uses tempest_lib instead of tempest wherever possible * Added a .testr.conf for use with testr * Currently, needs keystone to get Designate's endpoint Change-Id: I87a3f7c4fea55183eb2264a8b099344c6e3faa67
This commit is contained in:
parent
3bfb6904db
commit
dc2c1ae540
@ -49,6 +49,7 @@ Reference Documentation
|
||||
glossary
|
||||
backends
|
||||
integrations
|
||||
tempest
|
||||
|
||||
Source Documentation
|
||||
====================
|
||||
|
71
doc/source/tempest.rst
Normal file
71
doc/source/tempest.rst
Normal file
@ -0,0 +1,71 @@
|
||||
.. _tempest:
|
||||
|
||||
===============
|
||||
Tempest tests
|
||||
===============
|
||||
|
||||
The Tempest tests are functional tests that hit a live Designate endpoint and
|
||||
verify responses.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
The tests depend on both ``tempest-lib`` and ``tempest``:
|
||||
|
||||
::
|
||||
|
||||
# install tempest
|
||||
git clone https://github.com/openstack/tempest.git
|
||||
pip install tempest/
|
||||
|
||||
# tempest-lib is in test-requirements.txt
|
||||
cd designate
|
||||
pip install -r requirements.txt -r test-requirements.txt
|
||||
python setup.py develop
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
The Tempest tests look for the file ``functionaltests/designate-tempest.conf``,
|
||||
which contains information about your Keystone setup. For the time being, these
|
||||
tests require Keystone.
|
||||
|
||||
::
|
||||
|
||||
[identity]
|
||||
# Replace these with values that represent your identity configuration
|
||||
uri=http://localhost:5000/v2.0
|
||||
uri_v3=http://localhost:5000/v3
|
||||
auth_version=v2
|
||||
region=RegionOne
|
||||
|
||||
username=admin
|
||||
tenant_name=admin
|
||||
password=password
|
||||
domain_name=Default
|
||||
|
||||
admin_username=admin
|
||||
admin_tenant_name=admin
|
||||
admin_password=password
|
||||
admin_domain_name=Default
|
||||
|
||||
|
||||
Execution
|
||||
=========
|
||||
|
||||
The tests should work with any test runner, like ``nose``:
|
||||
|
||||
::
|
||||
|
||||
cd functionaltests
|
||||
pip install nose
|
||||
nosetests --logging-level=WARN api/
|
||||
|
||||
A file ``.testr.conf`` is included for use with ``testr``:
|
||||
|
||||
::
|
||||
|
||||
cd functionaltests
|
||||
pip install testrepository
|
||||
testr init
|
||||
testr run
|
4
functionaltests/.testr.conf
Normal file
4
functionaltests/.testr.conf
Normal file
@ -0,0 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=python -m subunit.run discover ./api $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
19
functionaltests/__init__.py
Normal file
19
functionaltests/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
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.config import CONF
|
||||
|
||||
CONF.set_config_path('designate-tempest.conf')
|
0
functionaltests/api/__init__.py
Normal file
0
functionaltests/api/__init__.py
Normal file
0
functionaltests/api/v2/__init__.py
Normal file
0
functionaltests/api/v2/__init__.py
Normal file
31
functionaltests/api/v2/test_zone.py
Normal file
31
functionaltests/api/v2/test_zone.py
Normal file
@ -0,0 +1,31 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
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 tempest_lib
|
||||
import tempest_lib.base
|
||||
|
||||
from functionaltests.common.client import DesignateClient
|
||||
|
||||
|
||||
class ZoneTest(tempest_lib.base.BaseTestCase):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ZoneTest, self).__init__(*args, **kwargs)
|
||||
self.client = DesignateClient()
|
||||
|
||||
def test_list_zones(self):
|
||||
resp, body = self.client.get('/v2/zones')
|
||||
self.assertEqual(resp.status, 200)
|
0
functionaltests/common/__init__.py
Normal file
0
functionaltests/common/__init__.py
Normal file
37
functionaltests/common/client.py
Normal file
37
functionaltests/common/client.py
Normal file
@ -0,0 +1,37 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
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_lib.common.rest_client import RestClient
|
||||
from tempest.auth import KeystoneV2Credentials
|
||||
from tempest.config import CONF
|
||||
import tempest.manager
|
||||
|
||||
|
||||
class DesignateClient(RestClient):
|
||||
|
||||
def __init__(self):
|
||||
creds = KeystoneV2Credentials(
|
||||
username=CONF.identity.username,
|
||||
password=CONF.identity.password,
|
||||
tenant_name=CONF.identity.tenant_name,
|
||||
)
|
||||
auth_provider = tempest.manager.get_auth_provider(creds)
|
||||
auth_provider.fill_credentials()
|
||||
super(DesignateClient, self).__init__(
|
||||
auth_provider=auth_provider,
|
||||
service='dns',
|
||||
region=CONF.identity.region,
|
||||
)
|
Loading…
Reference in New Issue
Block a user