Merge "Split functional tests for legacy(V2.1) and microversions"
This commit is contained in:
commit
f1ea28349b
novaclient/tests/functional/v2
0
novaclient/tests/functional/v2/__init__.py
Normal file
0
novaclient/tests/functional/v2/__init__.py
Normal file
0
novaclient/tests/functional/v2/legacy/__init__.py
Normal file
0
novaclient/tests/functional/v2/legacy/__init__.py
Normal file
@ -52,12 +52,3 @@ class TestFixedIPsNovaClient(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_fixedip_get(self):
|
def test_fixedip_get(self):
|
||||||
self._test_fixedip_get()
|
self._test_fixedip_get()
|
||||||
|
|
||||||
|
|
||||||
class TestFixedIPsNovaClientV24(TestFixedIPsNovaClient):
|
|
||||||
"""FixedIPs functional tests for v2.4 nova-api microversion."""
|
|
||||||
|
|
||||||
COMPUTE_API_VERSION = '2.4'
|
|
||||||
|
|
||||||
def test_fixedip_get(self):
|
|
||||||
self._test_fixedip_get(expect_reserved=True)
|
|
@ -16,7 +16,7 @@ import uuid
|
|||||||
from tempest_lib import exceptions
|
from tempest_lib import exceptions
|
||||||
|
|
||||||
from novaclient.tests.functional import base
|
from novaclient.tests.functional import base
|
||||||
from novaclient.tests.functional import fake_crypto
|
from novaclient.tests.functional.v2 import fake_crypto
|
||||||
|
|
||||||
|
|
||||||
class TestKeypairsNovaClient(base.ClientTestBase):
|
class TestKeypairsNovaClient(base.ClientTestBase):
|
||||||
@ -92,33 +92,3 @@ class TestKeypairsNovaClient(base.ClientTestBase):
|
|||||||
# keypair-show should fail if no keypair with given name is found.
|
# keypair-show should fail if no keypair with given name is found.
|
||||||
self.assertRaises(exceptions.CommandFailed,
|
self.assertRaises(exceptions.CommandFailed,
|
||||||
self._show_keypair, key_name)
|
self._show_keypair, key_name)
|
||||||
|
|
||||||
|
|
||||||
class TestKeypairsNovaClientV22(TestKeypairsNovaClient):
|
|
||||||
"""Keypairs functional tests for v2.2 nova-api microversion.
|
|
||||||
"""
|
|
||||||
|
|
||||||
COMPUTE_API_VERSION = "2.2"
|
|
||||||
|
|
||||||
def test_create_keypair(self):
|
|
||||||
keypair = super(TestKeypairsNovaClientV22, self).test_create_keypair()
|
|
||||||
self.assertIn('ssh', keypair)
|
|
||||||
|
|
||||||
def test_create_keypair_x509(self):
|
|
||||||
key_name = self._create_keypair(key_type='x509')
|
|
||||||
keypair = self._show_keypair(key_name)
|
|
||||||
self.assertIn(key_name, keypair)
|
|
||||||
self.assertIn('x509', keypair)
|
|
||||||
|
|
||||||
def test_import_keypair(self):
|
|
||||||
pub_key, fingerprint = fake_crypto.get_ssh_pub_key_and_fingerprint()
|
|
||||||
pub_key_file = self._create_public_key_file(pub_key)
|
|
||||||
keypair = self._test_import_keypair(fingerprint, pub_key=pub_key_file)
|
|
||||||
self.assertIn('ssh', keypair)
|
|
||||||
|
|
||||||
def test_import_keypair_x509(self):
|
|
||||||
certif, fingerprint = fake_crypto.get_x509_cert_and_fingerprint()
|
|
||||||
pub_key_file = self._create_public_key_file(certif)
|
|
||||||
keypair = self._test_import_keypair(fingerprint, key_type='x509',
|
|
||||||
pub_key=pub_key_file)
|
|
||||||
self.assertIn('x509', keypair)
|
|
0
novaclient/tests/functional/test_servers.py → novaclient/tests/functional/v2/legacy/test_servers.py
0
novaclient/tests/functional/test_servers.py → novaclient/tests/functional/v2/legacy/test_servers.py
23
novaclient/tests/functional/v2/test_fixedips.py
Normal file
23
novaclient/tests/functional/v2/test_fixedips.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2015 IBM Corp.
|
||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_fixedips
|
||||||
|
|
||||||
|
|
||||||
|
class TestFixedIPsNovaClientV24(test_fixedips.TestFixedIPsNovaClient):
|
||||||
|
"""FixedIPs functional tests for v2.4 nova-api microversion."""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = '2.4'
|
||||||
|
|
||||||
|
def test_fixedip_get(self):
|
||||||
|
self._test_fixedip_get(expect_reserved=True)
|
18
novaclient/tests/functional/v2/test_instances.py
Normal file
18
novaclient/tests/functional/v2/test_instances.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_instances
|
||||||
|
|
||||||
|
|
||||||
|
class TestInstanceCLI(test_instances.TestInstanceCLI):
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
44
novaclient/tests/functional/v2/test_keypairs.py
Normal file
44
novaclient/tests/functional/v2/test_keypairs.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2 import fake_crypto
|
||||||
|
from novaclient.tests.functional.v2.legacy import test_keypairs
|
||||||
|
|
||||||
|
|
||||||
|
class TestKeypairsNovaClientV22(test_keypairs.TestKeypairsNovaClient):
|
||||||
|
"""Keypairs functional tests for v2.2 nova-api microversion.
|
||||||
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.2"
|
||||||
|
|
||||||
|
def test_create_keypair(self):
|
||||||
|
keypair = super(TestKeypairsNovaClientV22, self).test_create_keypair()
|
||||||
|
self.assertIn('ssh', keypair)
|
||||||
|
|
||||||
|
def test_create_keypair_x509(self):
|
||||||
|
key_name = self._create_keypair(key_type='x509')
|
||||||
|
keypair = self._show_keypair(key_name)
|
||||||
|
self.assertIn(key_name, keypair)
|
||||||
|
self.assertIn('x509', keypair)
|
||||||
|
|
||||||
|
def test_import_keypair(self):
|
||||||
|
pub_key, fingerprint = fake_crypto.get_ssh_pub_key_and_fingerprint()
|
||||||
|
pub_key_file = self._create_public_key_file(pub_key)
|
||||||
|
keypair = self._test_import_keypair(fingerprint, pub_key=pub_key_file)
|
||||||
|
self.assertIn('ssh', keypair)
|
||||||
|
|
||||||
|
def test_import_keypair_x509(self):
|
||||||
|
certif, fingerprint = fake_crypto.get_x509_cert_and_fingerprint()
|
||||||
|
pub_key_file = self._create_public_key_file(certif)
|
||||||
|
keypair = self._test_import_keypair(fingerprint, key_type='x509',
|
||||||
|
pub_key=pub_key_file)
|
||||||
|
self.assertIn('x509', keypair)
|
52
novaclient/tests/functional/v2/test_quotas.py
Normal file
52
novaclient/tests/functional/v2/test_quotas.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_quotas
|
||||||
|
|
||||||
|
|
||||||
|
class TestQuotasNovaClient(test_quotas.TestQuotasNovaClient):
|
||||||
|
"""Nova quotas functional tests.
|
||||||
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
||||||
|
|
||||||
|
_quota_resources = ['instances', 'cores', 'ram',
|
||||||
|
'floating_ips', 'fixed_ips', 'metadata_items',
|
||||||
|
'injected_files', 'injected_file_content_bytes',
|
||||||
|
'injected_file_path_bytes', 'key_pairs',
|
||||||
|
'security_groups', 'security_group_rules',
|
||||||
|
'server_groups', 'server_group_members']
|
||||||
|
|
||||||
|
def test_quotas_update(self):
|
||||||
|
# `nova quota-update` requires tenant-id.
|
||||||
|
tenant_info = self.cli_clients.keystone(
|
||||||
|
"tenant-get", params=self.cli_clients.tenant_name)
|
||||||
|
tenant_id = self._get_value_from_the_table(tenant_info, "id")
|
||||||
|
|
||||||
|
self.addCleanup(self.client.quotas.delete, tenant_id)
|
||||||
|
|
||||||
|
original_quotas = self.client.quotas.get(tenant_id)
|
||||||
|
|
||||||
|
difference = 10
|
||||||
|
params = [tenant_id]
|
||||||
|
for quota_name in self._quota_resources:
|
||||||
|
params.append("--%(name)s %(value)s" % {
|
||||||
|
"name": quota_name.replace("_", "-"),
|
||||||
|
"value": getattr(original_quotas, quota_name) + difference})
|
||||||
|
|
||||||
|
self.nova("quota-update", params=" ".join(params))
|
||||||
|
|
||||||
|
updated_quotas = self.client.quotas.get(tenant_id)
|
||||||
|
|
||||||
|
for quota_name in self._quota_resources:
|
||||||
|
self.assertEqual(getattr(original_quotas, quota_name),
|
||||||
|
getattr(updated_quotas, quota_name) - difference)
|
25
novaclient/tests/functional/v2/test_readonly_nova.py
Normal file
25
novaclient/tests/functional/v2/test_readonly_nova.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_readonly_nova
|
||||||
|
|
||||||
|
|
||||||
|
class SimpleReadOnlyNovaClientTest(
|
||||||
|
test_readonly_nova.SimpleReadOnlyNovaClientTest):
|
||||||
|
|
||||||
|
"""
|
||||||
|
read only functional python-novaclient tests.
|
||||||
|
|
||||||
|
This only exercises client commands that are read only.
|
||||||
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
27
novaclient/tests/functional/v2/test_servers.py
Normal file
27
novaclient/tests/functional/v2/test_servers.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_servers
|
||||||
|
|
||||||
|
|
||||||
|
class TestServersBootNovaClient(test_servers.TestServersBootNovaClient):
|
||||||
|
"""Servers boot functional tests.
|
||||||
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
||||||
|
|
||||||
|
|
||||||
|
class TestServersListNovaClient(test_servers.TestServersListNovaClient):
|
||||||
|
"""Servers list functional tests.
|
||||||
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
18
novaclient/tests/functional/v2/test_volumes_api.py
Normal file
18
novaclient/tests/functional/v2/test_volumes_api.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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 novaclient.tests.functional.v2.legacy import test_volumes_api
|
||||||
|
|
||||||
|
|
||||||
|
class TestVolumesAPI(test_volumes_api.TestVolumesAPI):
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.latest"
|
Loading…
x
Reference in New Issue
Block a user