Merge "Fixed single quoted docstring"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index daa293c..3ec25ea 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -13,6 +13,19 @@
import sys
import os
+import subprocess
+
+# Build a tempest sample config file:
+def build_sample_config(app):
+ root_dir = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ subprocess.call(["oslo-config-generator", "--config-file",
+ "tools/config/config-generator.tempest.conf",
+ "--output-file", "doc/source/_static/tempest.conf"],
+ cwd=root_dir)
+
+def setup(app):
+ app.connect('builder-inited', build_sample_config)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 1ac34eb..8fe24c7 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -245,7 +245,7 @@
@test.idempotent_id('3e48f95d-e660-4fa9-85e0-5a3d85594384')
def test_trust_expire_invalid(self):
- # Test case to check we can check an invlaid expiry time
+ # Test case to check we can check an invalid expiry time
# is rejected with the correct error
# with an expiry specified
expires_str = 'bad.123Z'
diff --git a/tempest/clients.py b/tempest/clients.py
index b3fb8a8..7cb4347 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -243,8 +243,8 @@
# with identity v2
if CONF.identity_feature_enabled.api_v2 and \
CONF.identity.auth_version == 'v2':
- # EC2 and S3 clients, if used, will check onfigured AWS credentials
- # and generate new ones if needed
+ # EC2 and S3 clients, if used, will check configured AWS
+ # credentials and generate new ones if needed
self.ec2api_client = botoclients.APIClientEC2(self.identity_client)
self.s3_client = botoclients.ObjectClientS3(self.identity_client)
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 30fb38c..aef42be 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -503,7 +503,7 @@
def check_telemetry(self):
"""Check that ceilometer provides a sane sample.
- Confirm that there are more than one sample and that they have the
+ Confirm that there is more than one sample and that they have the
expected metadata.
If in check mode confirm that the oldest sample available is from
@@ -680,7 +680,7 @@
response = _get_image_by_name(client, image['name'])
if not response:
- LOG.info("Image '%s' does not exists" % image['name'])
+ LOG.info("Image '%s' does not exist" % image['name'])
continue
client.images.delete_image(response['id'])
@@ -729,7 +729,7 @@
# only create a network if the name isn't here
body = client.networks.list_networks()
if any(item['name'] == network['name'] for item in body['networks']):
- LOG.warning("Dupplicated network name: %s" % network['name'])
+ LOG.warning("Duplicated network name: %s" % network['name'])
continue
client.networks.create_network(name=network['name'])
@@ -781,7 +781,7 @@
# only create a router if the name isn't here
body = client.networks.list_routers()
if any(item['name'] == router['name'] for item in body['routers']):
- LOG.warning("Dupplicated router name: %s" % router['name'])
+ LOG.warning("Duplicated router name: %s" % router['name'])
continue
client.networks.create_router(router['name'])
@@ -813,7 +813,7 @@
# connect routers to their subnets
client.networks.add_router_interface_with_subnet_id(router_id,
subnet_id)
- # connect routers to exteral network if set to "gateway"
+ # connect routers to external network if set to "gateway"
if router['gateway']:
if CONF.network.public_network_id:
ext_net = CONF.network.public_network_id
@@ -871,7 +871,7 @@
server['name'], image_id, flavor_id, **kwargs)
server_id = body['id']
client.servers.wait_for_server_status(server_id, 'ACTIVE')
- # create to security group(s) after server spawning
+ # create security group(s) after server spawning
for secgroup in server['secgroups']:
client.servers.add_security_group(server_id, secgroup)
if CONF.compute.use_floatingip_for_ssh:
@@ -995,7 +995,7 @@
def create_resources():
LOG.info("Creating Resources")
# first create keystone level resources, and we need to be admin
- # for those.
+ # for this.
create_tenants(RES['tenants'])
create_users(RES['users'])
collect_users(RES['users'])
@@ -1015,7 +1015,7 @@
create_volumes(RES['volumes'])
# Only attempt attaching the volumes if servers are defined in the
- # resourcefile
+ # resource file
if 'servers' in RES:
create_servers(RES['servers'])
attach_volumes(RES['volumes'])
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 93c2c10..a567c6a 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -106,7 +106,8 @@
def get_nic_name(self, address):
cmd = "ip -o addr | awk '/%s/ {print $2}'" % address
- return self.exec_command(cmd)
+ nic = self.exec_command(cmd)
+ return nic.strip().strip(":").lower()
def get_ip_list(self):
cmd = "ip address"
@@ -144,7 +145,6 @@
"""Renews DHCP lease via udhcpc client. """
file_path = '/var/run/udhcpc.'
nic_name = self.get_nic_name(fixed_ip)
- nic_name = nic_name.strip().lower()
pid = self.exec_command('cat {path}{nic}.pid'.
format(path=file_path, nic=nic_name))
pid = pid.strip()
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 85a03cf..8112e9e 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -144,6 +144,8 @@
volume_status = body['status']
if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
+ if volume_status == 'error_restoring':
+ raise exceptions.VolumeRestoreErrorException(volume_id=volume_id)
if int(time.time()) - start >= client.build_timeout:
message = ('Volume %s failed to reach %s status (current %s) '
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 15617c6..15482ab 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -92,6 +92,10 @@
message = "Volume %(volume_id)s failed to build and is in ERROR status"
+class VolumeRestoreErrorException(TempestException):
+ message = "Volume %(volume_id)s failed to restore and is in ERROR status"
+
+
class SnapshotBuildErrorException(TempestException):
message = "Snapshot %(snapshot_id)s failed to build and is in ERROR status"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index da4ebbe..89b0842 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -663,14 +663,18 @@
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
ports = self._list_ports(device_id=server['id'],
fixed_ip=ip_addr)
- self.assertEqual(len(ports), 1,
- "Unable to determine which port to target.")
# it might happen here that this port has more then one ip address
# as in case of dual stack- when this port is created on 2 subnets
- for ip46 in ports[0]['fixed_ips']:
- ip = ip46['ip_address']
- if netaddr.valid_ipv4(ip):
- return ports[0]['id'], ip
+ port_map = [(p["id"], fxip["ip_address"])
+ for p in ports
+ for fxip in p["fixed_ips"]
+ if netaddr.valid_ipv4(fxip["ip_address"])]
+
+ self.assertEqual(len(port_map), 1,
+ "Found multiple IPv4 addresses: %s. "
+ "Unable to determine which port to target."
+ % port_map)
+ return port_map[0]
def _get_network_by_name(self, network_name):
net = self._list_networks(name=network_name)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 9481e58..a9394cb 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -69,13 +69,18 @@
'key_name': self.keypair['name'],
'security_groups': [{'name': self.sec_grp['name']}]}
- def prepare_network(self, address6_mode, n_subnets6=1):
+ def prepare_network(self, address6_mode, n_subnets6=1, dualnet=False):
"""Creates network with
given number of IPv6 subnets in the given mode and
one IPv4 subnet
Creates router with ports on all subnets
+ if dualnet - create IPv6 subnets on a different network
+ :return: list of created networks
"""
self.network = self._create_network(tenant_id=self.tenant_id)
+ if dualnet:
+ self.network_v6 = self._create_network(tenant_id=self.tenant_id)
+
sub4 = self._create_subnet(network=self.network,
namestart='sub4',
ip_version=4)
@@ -86,7 +91,8 @@
self.subnets_v6 = []
for _ in range(n_subnets6):
- sub6 = self._create_subnet(network=self.network,
+ net6 = self.network_v6 if dualnet else self.network
+ sub6 = self._create_subnet(network=net6,
namestart='sub6',
ip_version=6,
ipv6_ra_mode=address6_mode,
@@ -96,6 +102,8 @@
self.addCleanup(sub6.delete)
self.subnets_v6.append(sub6)
+ return [self.network, self.network_v6] if dualnet else [self.network]
+
@staticmethod
def define_server_ips(srv):
ips = {'4': None, '6': []}
@@ -107,11 +115,12 @@
ips['4'] = nic['addr']
return ips
- def prepare_server(self):
+ def prepare_server(self, networks=None):
username = CONF.compute.image_ssh_user
create_kwargs = self.srv_kwargs
- create_kwargs['networks'] = [{'uuid': self.network.id}]
+ networks = networks or [self.network]
+ create_kwargs['networks'] = [{'uuid': n.id} for n in networks]
srv = self.create_server(create_kwargs=create_kwargs)
fip = self.create_floating_ip(thing=srv)
@@ -119,18 +128,42 @@
ssh = self.get_remote_client(
server_or_ip=fip.floating_ip_address,
username=username)
- return ssh, ips
+ return ssh, ips, srv["id"]
- def _prepare_and_test(self, address6_mode, n_subnets6=1):
- self.prepare_network(address6_mode=address6_mode,
- n_subnets6=n_subnets6)
+ def turn_nic6_on(self, ssh, sid):
+ """Turns the IPv6 vNIC on
- sshv4_1, ips_from_api_1 = self.prepare_server()
- sshv4_2, ips_from_api_2 = self.prepare_server()
+ Required because guest images usually set only the first vNIC on boot.
+ Searches for the IPv6 vNIC's MAC and brings it up.
+
+ @param ssh: RemoteClient ssh instance to server
+ @param sid: server uuid
+ """
+ ports = [p["mac_address"] for p in
+ self._list_ports(device_id=sid,
+ network_id=self.network_v6.id)]
+ self.assertEqual(1, len(ports),
+ message="Multiple IPv6 ports found on network %s"
+ % self.network_v6)
+ mac6 = ports[0]
+ ssh.turn_nic_on(ssh.get_nic_name(mac6))
+
+ def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
+ net_list = self.prepare_network(address6_mode=address6_mode,
+ n_subnets6=n_subnets6,
+ dualnet=dualnet)
+
+ sshv4_1, ips_from_api_1, sid1 = self.prepare_server(networks=net_list)
+ sshv4_2, ips_from_api_2, sid2 = self.prepare_server(networks=net_list)
def guest_has_address(ssh, addr):
return addr in ssh.get_ip_list()
+ # Turn on 2nd NIC for Cirros when dualnet
+ if dualnet:
+ self.turn_nic6_on(sshv4_1, sid1)
+ self.turn_nic6_on(sshv4_2, sid2)
+
# get addresses assigned to vNIC as reported by 'ip address' utility
ips_from_ip_1 = sshv4_1.get_ip_list()
ips_from_ip_2 = sshv4_2.get_ip_list()
@@ -196,3 +229,25 @@
@test.services('compute', 'network')
def test_multi_prefix_slaac(self):
self._prepare_and_test(address6_mode='slaac', n_subnets6=2)
+
+ @test.idempotent_id('b6399d76-4438-4658-bcf5-0d6c8584fde2')
+ @test.services('compute', 'network')
+ def test_dualnet_slaac_from_os(self):
+ self._prepare_and_test(address6_mode='slaac', dualnet=True)
+
+ @test.idempotent_id('76f26acd-9688-42b4-bc3e-cd134c4cb09e')
+ @test.services('compute', 'network')
+ def test_dualnet_dhcp6_stateless_from_os(self):
+ self._prepare_and_test(address6_mode='dhcpv6-stateless', dualnet=True)
+
+ @test.idempotent_id('cf1c4425-766b-45b8-be35-e2959728eb00')
+ @test.services('compute', 'network')
+ def test_dualnet_multi_prefix_dhcpv6_stateless(self):
+ self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2,
+ dualnet=True)
+
+ @test.idempotent_id('9178ad42-10e4-47e9-8987-e02b170cc5cd')
+ @test.services('compute', 'network')
+ def test_dualnet_multi_prefix_slaac(self):
+ self._prepare_and_test(address6_mode='slaac', n_subnets6=2,
+ dualnet=True)
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index b31fe1b..e8ee20b 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -119,24 +119,6 @@
params={'limit': limit, 'format': 'json'})
self.expected_success(200, resp.status)
return objlist
- """tmp = []
- for obj in objlist:
- tmp.append(obj['name'])
- objlist = tmp
-
- if len(objlist) >= limit:
-
- # Increment marker
- marker = objlist[len(objlist) - 1]
-
- # Get the next chunk of the list
- objlist.extend(_list_all_container_objects(container,
- params={'marker': marker,
- 'limit': limit}))
- return objlist
- else:
- # Return final, complete list
- return objlist"""
def list_container_contents(self, container, params=None):
"""
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 0e0141f..c89985c 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -165,7 +165,7 @@
if not self.new_server:
self.new_server_ops()
- # now we just test is number of partition increased or decrised
+ # now we just test that the number of partitions has increased or decreased
def part_wait(self, num_match):
def _part_state():
self.partitions = self.remote_client.get_partitions().split('\n')
@@ -205,7 +205,7 @@
self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
if self.enable_ssh_verify:
- self.logger.info("Scanning for block device disapperance on %s"
+ self.logger.info("Scanning for block device disappearance on %s"
% self.server_id)
self.part_wait(self.detach_match_count)
if self.new_volume:
diff --git a/tempest/tests/test_waiters.py b/tempest/tests/common/test_waiters.py
similarity index 65%
rename from tempest/tests/test_waiters.py
rename to tempest/tests/common/test_waiters.py
index 329d610..7aa6595 100644
--- a/tempest/tests/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -18,6 +18,7 @@
from tempest.common import waiters
from tempest import exceptions
+from tempest.services.volume.json import volumes_client
from tempest.tests import base
@@ -47,3 +48,21 @@
self.assertRaises(exceptions.AddImageException,
waiters.wait_for_image_status,
self.client, 'fake_image_id', 'active')
+
+ @mock.patch.object(time, 'sleep')
+ def test_wait_for_volume_status_error_restoring(self, mock_sleep):
+ # Tests that the wait method raises VolumeRestoreErrorException if
+ # the volume status is 'error_restoring'.
+ client = mock.Mock(spec=volumes_client.BaseVolumesClient,
+ build_interval=1)
+ volume1 = {'status': 'restoring-backup'}
+ volume2 = {'status': 'error_restoring'}
+ mock_show = mock.Mock(side_effect=(volume1, volume2))
+ client.show_volume = mock_show
+ volume_id = '7532b91e-aa0a-4e06-b3e5-20c0c5ee1caa'
+ self.assertRaises(exceptions.VolumeRestoreErrorException,
+ waiters.wait_for_volume_status,
+ client, volume_id, 'available')
+ mock_show.assert_has_calls([mock.call(volume_id),
+ mock.call(volume_id)])
+ mock_sleep.assert_called_once_with(1)
diff --git a/tempest/tests/services/compute/test_extensions_client.py b/tempest/tests/services/compute/test_extensions_client.py
new file mode 100644
index 0000000..aa46efa
--- /dev/null
+++ b/tempest/tests/services/compute/test_extensions_client.py
@@ -0,0 +1,75 @@
+# 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.
+
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import extensions_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestExtensionsClient(base.TestCase):
+
+ def setUp(self):
+ super(TestExtensionsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = extensions_client.ExtensionsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_extensions(self, bytes_body=False):
+ body = '{"extensions": []}'
+ if bytes_body:
+ body = body.encode('utf-8')
+ expected = []
+ response = (httplib2.Response({'status': 200}), body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=response))
+ self.assertEqual(expected, self.client.list_extensions())
+
+ def test_list_extensions_with_str_body(self):
+ self._test_list_extensions()
+
+ def test_list_extensions_with_bytes_body(self):
+ self._test_list_extensions(bytes_body=True)
+
+ def _test_show_extension(self, bytes_body=False):
+ expected = {
+ "updated": "2011-06-09T00:00:00Z",
+ "name": "Multinic",
+ "links": [],
+ "namespace":
+ "http://docs.openstack.org/compute/ext/multinic/api/v1.1",
+ "alias": "NMN",
+ "description": u'\u2740(*\xb4\u25e1`*)\u2740'
+ }
+ serialized_body = json.dumps({"extension": expected})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_extension("NMN")
+ self.assertEqual(expected, resp)
+
+ def test_show_extension_with_str_body(self):
+ self._test_show_extension()
+
+ def test_show_extension_with_bytes_body(self):
+ self._test_show_extension(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_keypairs_client.py b/tempest/tests/services/compute/test_keypairs_client.py
index e79e411..a0022b4 100644
--- a/tempest/tests/services/compute/test_keypairs_client.py
+++ b/tempest/tests/services/compute/test_keypairs_client.py
@@ -12,8 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+import copy
import httplib2
+from oslo_serialization import jsonutils as json
from oslotest import mockpatch
from tempest.services.compute.json import keypairs_client
@@ -23,6 +25,13 @@
class TestKeyPairsClient(base.TestCase):
+ FAKE_KEYPAIR = {
+ "public_key": "ssh-rsa foo Generated-by-Nova",
+ "name": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "user_id": "525d55f98980415ba98e634972fa4a10",
+ "fingerprint": "76:24:66:49:d7:ca:6e:5c:77:ea:8e:bb:9c:15:5f:98"
+ }
+
def setUp(self):
super(TestKeyPairsClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
@@ -45,3 +54,58 @@
def test_list_keypairs_with_bytes_body(self):
self._test_list_keypairs(bytes_body=True)
+
+ def _test_show_keypair(self, bytes_body=False):
+ fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
+ fake_keypair.update({
+ "deleted": False,
+ "created_at": "2015-07-22T04:53:52.000000",
+ "updated_at": None,
+ "deleted_at": None,
+ "id": 1
+ })
+ serialized_body = json.dumps({"keypair": fake_keypair})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_keypair("test")
+ self.assertEqual(fake_keypair, resp)
+
+ def test_show_keypair_with_str_body(self):
+ self._test_show_keypair()
+
+ def test_show_keypair_with_bytes_body(self):
+ self._test_show_keypair(bytes_body=True)
+
+ def _test_create_keypair(self, bytes_body=False):
+ fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
+ fake_keypair.update({"private_key": "foo"})
+ serialized_body = json.dumps({"keypair": fake_keypair})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.post',
+ return_value=mocked_resp))
+ resp = self.client.create_keypair(name='test')
+ self.assertEqual(fake_keypair, resp)
+
+ def test_create_keypair_with_str_body(self):
+ self._test_create_keypair()
+
+ def test_create_keypair_with_bytes_body(self):
+ self._test_create_keypair(bytes_body=True)
+
+ def test_delete_keypair(self):
+ expected = {}
+ mocked_resp = (httplib2.Response({'status': 202}), None)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.delete',
+ return_value=mocked_resp))
+ resp = self.client.delete_keypair('test')
+ self.assertEqual(expected, resp)
diff --git a/tempest/tests/services/compute/test_quota_classes_client.py b/tempest/tests/services/compute/test_quota_classes_client.py
new file mode 100644
index 0000000..ff9b310
--- /dev/null
+++ b/tempest/tests/services/compute/test_quota_classes_client.py
@@ -0,0 +1,81 @@
+# 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.
+
+import copy
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import quota_classes_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestQuotaClassesClient(base.TestCase):
+
+ FAKE_QUOTA_CLASS_SET = {
+ "injected_file_content_bytes": 10240,
+ "metadata_items": 128,
+ "server_group_members": 10,
+ "server_groups": 10,
+ "ram": 51200,
+ "floating_ips": 10,
+ "key_pairs": 100,
+ "id": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "instances": 10,
+ "security_group_rules": 20,
+ "security_groups": 10,
+ "injected_files": 5,
+ "cores": 20,
+ "fixed_ips": -1,
+ "injected_file_path_bytes": 255,
+ }
+
+ def setUp(self):
+ super(TestQuotaClassesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quota_classes_client.QuotaClassesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_quota_class_set(self, bytes_body=False):
+ serialized_body = json.dumps({
+ "quota_class_set": self.FAKE_QUOTA_CLASS_SET})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_quota_class_set("test")
+ self.assertEqual(self.FAKE_QUOTA_CLASS_SET, resp)
+
+ def test_show_quota_class_set_with_str_body(self):
+ self._test_show_quota_class_set()
+
+ def test_show_quota_class_set_with_bytes_body(self):
+ self._test_show_quota_class_set(bytes_body=True)
+
+ def test_update_quota_class_set(self):
+ fake_quota_class_set = copy.deepcopy(self.FAKE_QUOTA_CLASS_SET)
+ fake_quota_class_set.pop("id")
+ serialized_body = json.dumps({"quota_class_set": fake_quota_class_set})
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.put',
+ return_value=mocked_resp))
+ resp = self.client.update_quota_class_set("test")
+ self.assertEqual(fake_quota_class_set, resp)
diff --git a/tox.ini b/tox.ini
index eae6fc7..15652e8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -110,7 +110,6 @@
[testenv:docs]
# The sample config file we generate is included in the sphinxdoc, so build that first.
commands =
- oslo-config-generator --config-file tools/config/config-generator.tempest.conf --output-file doc/source/_static/tempest.conf
python setup.py build_sphinx {posargs}
[testenv:pep8]