Merge "Rename isolated creds to dynamic creds"
diff --git a/README.rst b/README.rst
index 7108eaf..bf513bd 100644
--- a/README.rst
+++ b/README.rst
@@ -168,7 +168,7 @@
$> cd $TEMPEST_ROOT_DIR
$> oslo-config-generator --config-file \
- tools/config/config-generator.tempest.conf \
+ etc/config-generator.tempest.conf \
--output-file etc/tempest.conf
After that, open up the ``etc/tempest.conf`` file and edit the
diff --git a/doc/source/conf.py b/doc/source/conf.py
index f85899b..12d1d40 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -34,7 +34,7 @@
'oslo_config.sphinxconfiggen',
]
-config_generator_config_file = '../../tools/config/config-generator.tempest.conf'
+config_generator_config_file = '../../etc/config-generator.tempest.conf'
sample_config_basename = '_static/tempest'
todo_include_todos = True
diff --git a/tools/config/config-generator.tempest.conf b/etc/config-generator.tempest.conf
similarity index 100%
rename from tools/config/config-generator.tempest.conf
rename to etc/config-generator.tempest.conf
diff --git a/requirements.txt b/requirements.txt
index 811580a..ddd2a6b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,6 +22,6 @@
iso8601>=0.1.9
fixtures>=1.3.1
testscenarios>=0.4
-tempest-lib>=0.8.0
+tempest-lib>=0.9.0
PyYAML>=3.1.0
stevedore>=1.5.0 # Apache-2.0
diff --git a/tempest/api/network/test_subnetpools_extensions.py b/tempest/api/network/test_subnetpools_extensions.py
new file mode 100644
index 0000000..09478ca
--- /dev/null
+++ b/tempest/api/network/test_subnetpools_extensions.py
@@ -0,0 +1,78 @@
+# Copyright 2015 GlobalLogic. All rights reserved.
+#
+# 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.api.network import base
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest import test
+from tempest_lib import exceptions as lib_exc
+
+CONF = config.CONF
+
+
+class SubnetPoolsTestJSON(base.BaseNetworkTest):
+ """
+ Tests the following operations in the subnetpools API using the REST client
+ for Neutron:
+
+ Create a subnet pool.
+ Update a subnet pool.
+ Delete a subnet pool.
+ Lists subnet pool.
+ Show subnet pool details.
+
+ v2.0 of the Neutron API is assumed. It is assumed that subnetpools
+ options mentioned in the [network-feature-enabled] section and
+ default_network option mentioned in the [network] section of
+ etc/tempest.conf:
+
+ """
+
+ @classmethod
+ def skip_checks(cls):
+ super(SubnetPoolsTestJSON, cls).skip_checks()
+ if not test.is_extension_enabled('subnetpools', 'network'):
+ msg = "subnet pools extension not enabled."
+ raise cls.skipException(msg)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('62595970-ab1c-4b7f-8fcc-fddfe55e9811')
+ def test_create_list_show_update_delete_subnetpools(self):
+ subnetpool_name = data_utils.rand_name('subnetpools')
+ # create subnet pool
+ prefix = CONF.network.default_network
+ body = self.client.create_subnetpools(name=subnetpool_name,
+ prefixes=prefix)
+ subnetpool_id = body["subnetpool"]["id"]
+ self.addCleanup(self._cleanup_subnetpools, subnetpool_id)
+ self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
+ # get detail about subnet pool
+ body = self.client.show_subnetpools(subnetpool_id)
+ self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
+ # update the subnet pool
+ subnetpool_name = data_utils.rand_name('subnetpools_update')
+ body = self.client.update_subnetpools(subnetpool_id,
+ name=subnetpool_name)
+ self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
+ # delete subnet pool
+ body = self.client.delete_subnetpools(subnetpool_id)
+ self.assertRaises(lib_exc.NotFound, self.client.show_subnetpools,
+ subnetpool_id)
+
+ def _cleanup_subnetpools(self, subnetpool_id):
+ # this is used to cleanup the resources
+ try:
+ self.client.delete_subnetpools(subnetpool_id)
+ except lib_exc.NotFound:
+ pass
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index 2477ee7..9185553 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -16,8 +16,11 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.volume import base
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class BaseVolumeQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
force_tenant_isolation = True
@@ -31,8 +34,8 @@
def resource_setup(cls):
super(BaseVolumeQuotasNegativeV2TestJSON, cls).resource_setup()
cls.default_volume_size = cls.volumes_client.default_volume_size
- cls.shared_quota_set = {'gigabytes': 3 * cls.default_volume_size,
- 'volumes': 1, 'snapshots': 1}
+ cls.shared_quota_set = {'gigabytes': 2 * cls.default_volume_size,
+ 'volumes': 1}
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with dynamic credentials.
@@ -43,7 +46,6 @@
# NOTE(gfidente): no need to delete in tearDown as
# they are created using utility wrapper methods.
cls.volume = cls.create_volume()
- cls.snapshot = cls.create_snapshot(cls.volume['id'])
@test.attr(type='negative')
@test.idempotent_id('bf544854-d62a-47f2-a681-90f7a47d86b6')
@@ -52,13 +54,6 @@
self.volumes_client.create_volume)
@test.attr(type='negative')
- @test.idempotent_id('02bbf63f-6c05-4357-9d98-2926a94064ff')
- def test_quota_volume_snapshots(self):
- self.assertRaises(lib_exc.OverLimit,
- self.snapshots_client.create_snapshot,
- self.volume['id'])
-
- @test.attr(type='negative')
@test.idempotent_id('2dc27eee-8659-4298-b900-169d71a91374')
def test_quota_volume_gigabytes(self):
# NOTE(gfidente): quota set needs to be changed for this test
@@ -67,8 +62,7 @@
self.addCleanup(self.quotas_client.update_quota_set,
self.demo_tenant_id,
**self.shared_quota_set)
-
- new_quota_set = {'gigabytes': 2 * self.default_volume_size,
+ new_quota_set = {'gigabytes': self.default_volume_size,
'volumes': 2, 'snapshots': 1}
self.quotas_client.update_quota_set(
self.demo_tenant_id,
@@ -76,15 +70,6 @@
self.assertRaises(lib_exc.OverLimit,
self.volumes_client.create_volume)
- new_quota_set = {'gigabytes': 2 * self.default_volume_size,
- 'volumes': 1, 'snapshots': 2}
- self.quotas_client.update_quota_set(
- self.demo_tenant_id,
- **self.shared_quota_set)
- self.assertRaises(lib_exc.OverLimit,
- self.snapshots_client.create_snapshot,
- self.volume['id'])
-
class VolumeQuotasNegativeV1TestJSON(BaseVolumeQuotasNegativeV2TestJSON):
_api_version = 1
diff --git a/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py b/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py
new file mode 100644
index 0000000..ce0b618
--- /dev/null
+++ b/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py
@@ -0,0 +1,81 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+# 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 import exceptions as lib_exc
+
+from tempest.api.volume import base
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+class VolumeSnapshotQuotasNegativeV2TestJSON(base.BaseVolumeAdminTest):
+ force_tenant_isolation = True
+
+ @classmethod
+ def skip_checks(cls):
+ super(VolumeSnapshotQuotasNegativeV2TestJSON, cls).skip_checks()
+ if not CONF.volume_feature_enabled.snapshot:
+ raise cls.skipException('Cinder volume snapshots are disabled')
+
+ @classmethod
+ def setup_credentials(cls):
+ super(VolumeSnapshotQuotasNegativeV2TestJSON, cls).setup_credentials()
+ cls.demo_tenant_id = cls.os.credentials.tenant_id
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumeSnapshotQuotasNegativeV2TestJSON, cls).resource_setup()
+ cls.default_volume_size = cls.volumes_client.default_volume_size
+ cls.shared_quota_set = {'gigabytes': 3 * cls.default_volume_size,
+ 'volumes': 1, 'snapshots': 1}
+
+ # NOTE(gfidente): no need to restore original quota set
+ # after the tests as they only work with tenant isolation.
+ cls.quotas_client.update_quota_set(
+ cls.demo_tenant_id,
+ **cls.shared_quota_set)
+
+ # NOTE(gfidente): no need to delete in tearDown as
+ # they are created using utility wrapper methods.
+ cls.volume = cls.create_volume()
+ cls.snapshot = cls.create_snapshot(cls.volume['id'])
+
+ @test.attr(type='negative')
+ @test.idempotent_id('02bbf63f-6c05-4357-9d98-2926a94064ff')
+ def test_quota_volume_snapshots(self):
+ self.assertRaises(lib_exc.OverLimit,
+ self.snapshots_client.create_snapshot,
+ self.volume['id'])
+
+ @test.attr(type='negative')
+ @test.idempotent_id('c99a1ca9-6cdf-498d-9fdf-25832babef27')
+ def test_quota_volume_gigabytes_snapshots(self):
+ self.addCleanup(self.quotas_client.update_quota_set,
+ self.demo_tenant_id,
+ **self.shared_quota_set)
+ new_quota_set = {'gigabytes': 2 * self.default_volume_size,
+ 'volumes': 1, 'snapshots': 2}
+ self.quotas_client.update_quota_set(
+ self.demo_tenant_id,
+ **new_quota_set)
+ self.assertRaises(lib_exc.OverLimit,
+ self.snapshots_client.create_snapshot,
+ self.volume['id'])
+
+
+class VolumeSnapshotNegativeV1TestJSON(VolumeSnapshotQuotasNegativeV2TestJSON):
+ _api_version = 1
diff --git a/tempest/api_schema/response/compute/v2_1/services.py b/tempest/api_schema/response/compute/v2_1/services.py
index c2c7a51..ddef7b2 100644
--- a/tempest/api_schema/response/compute/v2_1/services.py
+++ b/tempest/api_schema/response/compute/v2_1/services.py
@@ -43,7 +43,7 @@
}
}
-enable_service = {
+enable_disable_service = {
'status_code': [200],
'response_body': {
'type': 'object',
diff --git a/tempest/clients.py b/tempest/clients.py
index dd0d145..cffdc3f 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -16,6 +16,7 @@
import copy
from oslo_log import log as logging
+from tempest_lib.services.compute.agents_client import AgentsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -27,8 +28,6 @@
from tempest.services.baremetal.v1.json.baremetal_client import \
BaremetalClient
from tempest.services import botoclients
-from tempest.services.compute.json.agents_client import \
- AgentsClient
from tempest.services.compute.json.aggregates_client import \
AggregatesClient
from tempest.services.compute.json.availability_zone_client import \
@@ -81,8 +80,8 @@
from tempest.services.compute.json.tenant_usages_client import \
TenantUsagesClient
from tempest.services.compute.json.versions_client import VersionsClient
-from tempest.services.compute.json.volumes_extensions_client import \
- VolumesExtensionsClient
+from tempest.services.compute.json.volumes_client import \
+ VolumesClient as ComputeVolumesClient
from tempest.services.data_processing.v1_1.data_processing_client import \
DataProcessingClient
from tempest.services.database.json.flavors_client import \
@@ -334,7 +333,7 @@
'build_interval': CONF.volume.build_interval,
'build_timeout': CONF.volume.build_timeout
})
- self.volumes_extensions_client = VolumesExtensionsClient(
+ self.volumes_extensions_client = ComputeVolumesClient(
self.auth_provider, **params_volume)
self.compute_versions_client = VersionsClient(self.auth_provider,
**params_volume)
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index c26df96..02c6e7f 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -160,7 +160,7 @@
def create_resources(opts, resources):
(identity_admin, neutron_iso_networks,
network_admin, networks_admin) = get_admin_clients(opts)
- roles = identity_admin.list_roles()
+ roles = identity_admin.list_roles()['roles']
for u in resources['users']:
u['role_ids'] = []
for r in u.get('roles', ()):
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index 289b978..af8f270 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -52,17 +52,21 @@
real_prefix = getattr(sys, 'real_prefix', None)
base_prefix = getattr(sys, 'base_prefix', None)
prefix = sys.prefix
- if real_prefix is None and base_prefix is None:
- # Not running in a virtual environnment of any kind
- return '/etc/tempest'
- elif (real_prefix is None and base_prefix is not None and
- base_prefix == prefix):
- # Probably not running in a virtual environment
+ if (real_prefix is None and
+ (base_prefix is None or base_prefix == prefix)):
+ # Probably not running in a virtual environment.
# NOTE(andreaf) we cannot distinguish this case from the case of
# a virtual environment created with virtualenv, and running python3.
- return '/etc/tempest'
+ # Also if it appears we are not in virtual env and fail to find
+ # global config: '/etc/tempest', fall back to
+ # '[sys.prefix]/etc/tempest'
+ global_conf_dir = '/etc/tempest'
+ if os.path.isdir(global_conf_dir):
+ return global_conf_dir
+ else:
+ return os.path.join(prefix, 'etc/tempest')
else:
- return os.path.join(sys.prefix, 'etc/tempest')
+ return os.path.join(prefix, 'etc/tempest')
class TempestInit(command.Command):
@@ -99,9 +103,12 @@
def copy_config(self, etc_dir, config_dir):
shutil.copytree(config_dir, etc_dir)
- def generate_sample_config(self, local_dir):
+ def generate_sample_config(self, local_dir, config_dir):
+ conf_generator = os.path.join(config_dir,
+ 'config-generator.tempest.conf')
+
subprocess.call(['oslo-config-generator', '--config-file',
- 'tools/config/config-generator.tempest.conf'],
+ conf_generator],
cwd=local_dir)
def create_working_dir(self, local_dir, config_dir):
@@ -109,6 +116,10 @@
if not os.path.isdir(local_dir):
LOG.debug('Creating local working dir: %s' % local_dir)
os.mkdir(local_dir)
+ else:
+ raise OSError("Directory you are trying to initialize already "
+ "exists: %s" % local_dir)
+
lock_dir = os.path.join(local_dir, 'tempest_lock')
etc_dir = os.path.join(local_dir, 'etc')
config_path = os.path.join(etc_dir, 'tempest.conf')
@@ -125,7 +136,7 @@
# Create and copy local etc dir
self.copy_config(etc_dir, config_dir)
# Generate the sample config file
- self.generate_sample_config(local_dir)
+ self.generate_sample_config(local_dir, config_dir)
# Update local confs to reflect local paths
self.update_local_conf(config_path, lock_dir, log_dir)
# Generate a testr conf file
diff --git a/tempest/config.py b/tempest/config.py
index dd16f94..3c25e1f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -562,6 +562,10 @@
" with pre-configured ports."
" Supported ports are:"
" ['normal','direct','macvtap']"),
+ cfg.ListOpt('default_network',
+ default=["1.0.0.0/16", "2.0.0.0/16"],
+ help="List of ip pools"
+ " for subnetpools creation"),
]
network_feature_group = cfg.OptGroup(name='network-feature-enabled',
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
deleted file mode 100644
index d38c8cd..0000000
--- a/tempest/services/compute/json/agents_client.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import agents as schema
-from tempest.common import service_client
-
-
-class AgentsClient(service_client.ServiceClient):
- """
- Tests Agents API
- """
-
- def list_agents(self, **params):
- """List all agent builds."""
- url = 'os-agents'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_agents, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_agent(self, **kwargs):
- """Create an agent build."""
- post_body = json.dumps({'agent': kwargs})
- resp, body = self.post('os-agents', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_agent, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_agent(self, agent_id):
- """Delete an existing agent build."""
- resp, body = self.delete("os-agents/%s" % agent_id)
- self.validate_response(schema.delete_agent, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_agent(self, agent_id, **kwargs):
- """Update an agent build."""
- put_body = json.dumps({'para': kwargs})
- resp, body = self.put('os-agents/%s' % agent_id, put_body)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index 232b301..f82a18f 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -42,7 +42,7 @@
post_body = json.dumps({'binary': binary, 'host': host_name})
resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
- self.validate_response(schema.enable_service, resp, body)
+ self.validate_response(schema.enable_disable_service, resp, body)
return service_client.ResponseBody(resp, body)
def disable_service(self, host_name, binary):
@@ -54,4 +54,5 @@
post_body = json.dumps({'binary': binary, 'host': host_name})
resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
+ self.validate_response(schema.enable_disable_service, resp, body)
return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_client.py
similarity index 97%
rename from tempest/services/compute/json/volumes_extensions_client.py
rename to tempest/services/compute/json/volumes_client.py
index db92351..e799c29 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_client.py
@@ -21,7 +21,7 @@
from tempest.common import service_client
-class VolumesExtensionsClient(service_client.ServiceClient):
+class VolumesClient(service_client.ServiceClient):
def list_volumes(self, detail=False, **params):
"""List all the volumes created."""
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 10bd23e..d766aa5 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -423,3 +423,25 @@
post_body = {'network_id': network_id}
uri = '/agents/%s/dhcp-networks' % agent_id
return self.create_resource(uri, post_body)
+
+ def list_subnetpools(self, **filters):
+ uri = '/subnetpools'
+ return self.list_resources(uri, **filters)
+
+ def create_subnetpools(self, **kwargs):
+ uri = '/subnetpools'
+ post_data = {'subnetpool': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def show_subnetpools(self, subnetpool_id, **fields):
+ uri = '/subnetpools/%s' % subnetpool_id
+ return self.show_resource(uri, **fields)
+
+ def update_subnetpools(self, subnetpool_id, **kwargs):
+ uri = '/subnetpools/%s' % subnetpool_id
+ post_data = {'subnetpool': kwargs}
+ return self.update_resource(uri, post_data)
+
+ def delete_subnetpools(self, subnetpool_id):
+ uri = '/subnetpools/%s' % subnetpool_id
+ return self.delete_resource(uri)
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 6b5af7e..2b868be 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+# import mock
import os
import fixtures
@@ -39,9 +40,19 @@
self.addCleanup(conf_file.close)
self.assertEqual(conf_file.read(), testr_conf_file)
+ def test_create_working_dir_with_existing_local_dir(self):
+ fake_local_dir = self.useFixture(fixtures.TempDir())
+ fake_local_conf_dir = self.useFixture(fixtures.TempDir())
+ _init = init.TempestInit(None, None)
+ self.assertRaises(OSError,
+ _init.create_working_dir,
+ fake_local_dir.path,
+ fake_local_conf_dir.path)
+
def test_create_working_dir(self):
fake_local_dir = self.useFixture(fixtures.TempDir())
fake_local_conf_dir = self.useFixture(fixtures.TempDir())
+ os.rmdir(fake_local_dir.path)
# Create a fake conf file
fake_file = fake_local_conf_dir.join('conf_file.conf')
open(fake_file, 'w').close()
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 00b8470..e4228a7 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -17,7 +17,6 @@
import six
from tempest.services.baremetal.v1.json import baremetal_client
-from tempest.services.compute.json import agents_client
from tempest.services.compute.json import aggregates_client
from tempest.services.compute.json import availability_zone_client
from tempest.services.compute.json import certificates_client
@@ -46,8 +45,8 @@
from tempest.services.compute.json import servers_client
from tempest.services.compute.json import services_client
from tempest.services.compute.json import tenant_usages_client
-from tempest.services.compute.json import volumes_extensions_client \
- as compute_volumes_extensions_client
+from tempest.services.compute.json import volumes_client \
+ as compute_volumes_client
from tempest.services.data_processing.v1_1 import data_processing_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
@@ -109,7 +108,6 @@
def test_service_client_creations_with_specified_args(self, mock_init):
test_clients = [
baremetal_client.BaremetalClient,
- agents_client.AgentsClient,
aggregates_client.AggregatesClient,
availability_zone_client.AvailabilityZoneClient,
certificates_client.CertificatesClient,
@@ -137,7 +135,7 @@
servers_client.ServersClient,
services_client.ServicesClient,
tenant_usages_client.TenantUsagesClient,
- compute_volumes_extensions_client.VolumesExtensionsClient,
+ compute_volumes_client.VolumesClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
db_version_client.DatabaseVersionsClient,
diff --git a/tempest/tests/services/compute/test_agents_client.py b/tempest/tests/services/compute/test_agents_client.py
deleted file mode 100644
index 31e576e..0000000
--- a/tempest/tests/services/compute/test_agents_client.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# 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.tests import fake_auth_provider
-
-from tempest.services.compute.json import agents_client
-from tempest.tests.services.compute import base
-
-
-class TestAgentsClient(base.BaseComputeServiceTest):
- FAKE_CREATE_AGENT = {
- "agent":
- {
- "url": "http://foo.com",
- "hypervisor": "kvm",
- "md5hash": "md5",
- "version": "2",
- "architecture": "x86_64",
- "os": "linux",
- "agent_id": 1
- }
- }
-
- FAKE_UPDATE_AGENT = {
- "agent":
- {
- "url": "http://foo.com",
- "hypervisor": "kvm",
- "md5hash": "md5",
- "version": "2",
- "architecture": "x86_64",
- "os": "linux",
- "agent_id": 1
- }
- }
-
- def setUp(self):
- super(TestAgentsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = agents_client.AgentsClient(fake_auth,
- 'compute', 'regionOne')
-
- def _test_list_agents(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_agents,
- 'tempest.common.service_client.ServiceClient.get',
- {"agents": []},
- bytes_body)
- self.check_service_client_function(
- self.client.list_agents,
- 'tempest.common.service_client.ServiceClient.get',
- {"agents": []},
- bytes_body,
- hypervisor="kvm")
-
- def _test_create_agent(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_agent,
- 'tempest.common.service_client.ServiceClient.post',
- self.FAKE_CREATE_AGENT,
- bytes_body,
- url="http://foo.com", hypervisor="kvm", md5hash="md5",
- version="2", architecture="x86_64", os="linux")
-
- def _test_delete_agent(self):
- self.check_service_client_function(
- self.client.delete_agent,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, agent_id="1")
-
- def _test_update_agent(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_agent,
- 'tempest.common.service_client.ServiceClient.put',
- self.FAKE_UPDATE_AGENT,
- bytes_body,
- agent_id="1", url="http://foo.com", md5hash="md5", version="2")
-
- def test_list_agents_with_str_body(self):
- self._test_list_agents()
-
- def test_list_agents_with_bytes_body(self):
- self._test_list_agents(bytes_body=True)
-
- def test_create_agent_with_str_body(self):
- self._test_create_agent()
-
- def test_create_agent_with_bytes_body(self):
- self._test_create_agent(bytes_body=True)
-
- def test_delete_agent(self):
- self._test_delete_agent()
-
- def test_update_agent_with_str_body(self):
- self._test_update_agent()
-
- def test_update_agent_with_bytes_body(self):
- self._test_update_agent(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_snapshots_client.py b/tempest/tests/services/compute/test_snapshots_client.py
new file mode 100644
index 0000000..c24c6ae
--- /dev/null
+++ b/tempest/tests/services/compute/test_snapshots_client.py
@@ -0,0 +1,103 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# 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 oslotest import mockpatch
+from tempest_lib import exceptions as lib_exc
+
+from tempest.services.compute.json import snapshots_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestSnapshotsClient(base.BaseComputeServiceTest):
+
+ FAKE_SNAPSHOT = {
+ "createdAt": "2015-10-02T16:27:54.724209",
+ "displayDescription": u"Another \u1234.",
+ "displayName": u"v\u1234-001",
+ "id": "100",
+ "size": 100,
+ "status": "available",
+ "volumeId": "12"
+ }
+
+ FAKE_SNAPSHOTS = {"snapshots": [FAKE_SNAPSHOT]}
+
+ def setUp(self):
+ super(TestSnapshotsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = snapshots_client.SnapshotsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_create_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_snapshot,
+ 'tempest.common.service_client.ServiceClient.post',
+ {"snapshot": self.FAKE_SNAPSHOT},
+ to_utf=bytes_body, status=200,
+ volume_id=self.FAKE_SNAPSHOT["volumeId"])
+
+ def test_create_snapshot_with_str_body(self):
+ self._test_create_snapshot()
+
+ def test_create_shapshot_with_bytes_body(self):
+ self._test_create_snapshot(bytes_body=True)
+
+ def _test_show_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_snapshot,
+ 'tempest.common.service_client.ServiceClient.get',
+ {"snapshot": self.FAKE_SNAPSHOT},
+ to_utf=bytes_body, snapshot_id=self.FAKE_SNAPSHOT["id"])
+
+ def test_show_snapshot_with_str_body(self):
+ self._test_show_snapshot()
+
+ def test_show_snapshot_with_bytes_body(self):
+ self._test_show_snapshot(bytes_body=True)
+
+ def _test_list_snapshots(self, bytes_body=False, **params):
+ self.check_service_client_function(
+ self.client.list_snapshots,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_SNAPSHOTS, to_utf=bytes_body, **params)
+
+ def test_list_snapshots_with_str_body(self):
+ self._test_list_snapshots()
+
+ def test_list_snapshots_with_byte_body(self):
+ self._test_list_snapshots(bytes_body=True)
+
+ def test_list_snapshots_with_params(self):
+ self._test_list_snapshots('fake')
+
+ def test_delete_snapshot(self):
+ self.check_service_client_function(
+ self.client.delete_snapshot,
+ 'tempest.common.service_client.ServiceClient.delete',
+ {}, status=202, snapshot_id=self.FAKE_SNAPSHOT['id'])
+
+ def test_is_resource_deleted_true(self):
+ module = ('tempest.services.compute.json.snapshots_client.'
+ 'SnapshotsClient.show_snapshot')
+ self.useFixture(mockpatch.Patch(
+ module, side_effect=lib_exc.NotFound))
+ self.assertTrue(self.client.is_resource_deleted('fake-id'))
+
+ def test_is_resource_deleted_false(self):
+ module = ('tempest.services.compute.json.snapshots_client.'
+ 'SnapshotsClient.show_snapshot')
+ self.useFixture(mockpatch.Patch(
+ module, return_value={}))
+ self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_volumes_extensions_client.py b/tempest/tests/services/compute/test_volumes_client.py
similarity index 87%
rename from tempest/tests/services/compute/test_volumes_extensions_client.py
rename to tempest/tests/services/compute/test_volumes_client.py
index 2fe8497..33d4bad 100644
--- a/tempest/tests/services/compute/test_volumes_extensions_client.py
+++ b/tempest/tests/services/compute/test_volumes_client.py
@@ -17,12 +17,12 @@
from oslotest import mockpatch
from tempest_lib import exceptions as lib_exc
-from tempest.services.compute.json import volumes_extensions_client
+from tempest.services.compute.json import volumes_client
from tempest.tests import fake_auth_provider
from tempest.tests.services.compute import base
-class TestVolumesExtensionsClient(base.BaseComputeServiceTest):
+class TestVolumesClient(base.BaseComputeServiceTest):
FAKE_VOLUME = {
"id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
@@ -43,9 +43,9 @@
FAKE_VOLUMES = {"volumes": [FAKE_VOLUME]}
def setUp(self):
- super(TestVolumesExtensionsClient, self).setUp()
+ super(TestVolumesClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = volumes_extensions_client.VolumesExtensionsClient(
+ self.client = volumes_client.VolumesClient(
fake_auth, 'compute', 'regionOne')
def _test_list_volumes(self, bytes_body=False, **params):
@@ -100,15 +100,15 @@
{}, status=202, volume_id=self.FAKE_VOLUME['id'])
def test_is_resource_deleted_true(self):
- module = ('tempest.services.compute.json.volumes_extensions_client.'
- 'VolumesExtensionsClient.show_volume')
+ module = ('tempest.services.compute.json.volumes_client.'
+ 'VolumesClient.show_volume')
self.useFixture(mockpatch.Patch(
module, side_effect=lib_exc.NotFound))
self.assertTrue(self.client.is_resource_deleted('fake-id'))
def test_is_resource_deleted_false(self):
- module = ('tempest.services.compute.json.volumes_extensions_client.'
- 'VolumesExtensionsClient.show_volume')
+ module = ('tempest.services.compute.json.volumes_client.'
+ 'VolumesClient.show_volume')
self.useFixture(mockpatch.Patch(
module, return_value={}))
self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tox.ini b/tox.ini
index 3250344..09c8626 100644
--- a/tox.ini
+++ b/tox.ini
@@ -24,7 +24,7 @@
bash tools/pretty_tox.sh '{posargs}'
[testenv:genconfig]
-commands = oslo-config-generator --config-file tools/config/config-generator.tempest.conf
+commands = oslo-config-generator --config-file etc/config-generator.tempest.conf
[testenv:cover]
setenv = OS_TEST_PATH=./tempest/tests