Merge "Specify api_version for functional tests"
This commit is contained in:
commit
1f1ce37440
@ -70,6 +70,8 @@ class ClientTestBase(testtools.TestCase):
|
|||||||
* initially just check return codes, and later test command outputs
|
* initially just check return codes, and later test command outputs
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
COMPUTE_API_VERSION = None
|
||||||
|
|
||||||
log_format = ('%(asctime)s %(process)d %(levelname)-8s '
|
log_format = ('%(asctime)s %(process)d %(levelname)-8s '
|
||||||
'[%(name)s] %(message)s')
|
'[%(name)s] %(message)s')
|
||||||
|
|
||||||
@ -170,9 +172,12 @@ class ClientTestBase(testtools.TestCase):
|
|||||||
uri=auth_url,
|
uri=auth_url,
|
||||||
cli_dir=cli_dir)
|
cli_dir=cli_dir)
|
||||||
|
|
||||||
def nova(self, *args, **kwargs):
|
def nova(self, action, flags='', params='', fail_ok=False,
|
||||||
return self.cli_clients.nova(*args,
|
endpoint_type='publicURL', merge_stderr=False):
|
||||||
**kwargs)
|
if self.COMPUTE_API_VERSION:
|
||||||
|
flags += " --os-compute-api-version %s " % self.COMPUTE_API_VERSION
|
||||||
|
return self.cli_clients.nova(action, flags, params, fail_ok,
|
||||||
|
endpoint_type, merge_stderr)
|
||||||
|
|
||||||
def wait_for_volume_status(self, volume, status, timeout=60,
|
def wait_for_volume_status(self, volume, status, timeout=60,
|
||||||
poll_interval=1):
|
poll_interval=1):
|
||||||
|
@ -20,11 +20,7 @@ from novaclient.v2 import shell
|
|||||||
class TestFixedIPsNovaClient(base.ClientTestBase):
|
class TestFixedIPsNovaClient(base.ClientTestBase):
|
||||||
"""FixedIPs functional tests."""
|
"""FixedIPs functional tests."""
|
||||||
|
|
||||||
API_VERSION = '2.1'
|
COMPUTE_API_VERSION = '2.1'
|
||||||
|
|
||||||
def nova(self, *args, **kwargs):
|
|
||||||
flags = '--os-compute-api-version %s ' % self.API_VERSION
|
|
||||||
return self.cli_clients.nova(flags=flags, *args, **kwargs)
|
|
||||||
|
|
||||||
def _create_server(self):
|
def _create_server(self):
|
||||||
name = self.name_generate(prefix='server')
|
name = self.name_generate(prefix='server')
|
||||||
@ -61,7 +57,7 @@ class TestFixedIPsNovaClient(base.ClientTestBase):
|
|||||||
class TestFixedIPsNovaClientV24(TestFixedIPsNovaClient):
|
class TestFixedIPsNovaClientV24(TestFixedIPsNovaClient):
|
||||||
"""FixedIPs functional tests for v2.4 nova-api microversion."""
|
"""FixedIPs functional tests for v2.4 nova-api microversion."""
|
||||||
|
|
||||||
API_VERSION = '2.4'
|
COMPUTE_API_VERSION = '2.4'
|
||||||
|
|
||||||
def test_fixedip_get(self):
|
def test_fixedip_get(self):
|
||||||
self._test_fixedip_get(expect_reserved=True)
|
self._test_fixedip_get(expect_reserved=True)
|
||||||
|
@ -15,6 +15,8 @@ from novaclient.tests.functional import base
|
|||||||
|
|
||||||
class TestInstanceCLI(base.ClientTestBase):
|
class TestInstanceCLI(base.ClientTestBase):
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def test_attach_volume(self):
|
def test_attach_volume(self):
|
||||||
"""Test we can attach a volume via the cli.
|
"""Test we can attach a volume via the cli.
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ class TestKeypairsNovaClient(base.ClientTestBase):
|
|||||||
"""Keypairs functional tests.
|
"""Keypairs functional tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def _serialize_kwargs(self, kwargs):
|
def _serialize_kwargs(self, kwargs):
|
||||||
kwargs_pairs = ['--%(key)s %(val)s' % {'key': key.replace('_', '-'),
|
kwargs_pairs = ['--%(key)s %(val)s' % {'key': key.replace('_', '-'),
|
||||||
'val': val}
|
'val': val}
|
||||||
@ -96,9 +98,7 @@ class TestKeypairsNovaClientV22(TestKeypairsNovaClient):
|
|||||||
"""Keypairs functional tests for v2.2 nova-api microversion.
|
"""Keypairs functional tests for v2.2 nova-api microversion.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def nova(self, *args, **kwargs):
|
COMPUTE_API_VERSION = "2.2"
|
||||||
return self.cli_clients.nova(flags='--os-compute-api-version 2.2 ',
|
|
||||||
*args, **kwargs)
|
|
||||||
|
|
||||||
def test_create_keypair(self):
|
def test_create_keypair(self):
|
||||||
keypair = super(TestKeypairsNovaClientV22, self).test_create_keypair()
|
keypair = super(TestKeypairsNovaClientV22, self).test_create_keypair()
|
||||||
|
@ -17,6 +17,8 @@ class TestQuotasNovaClient(base.ClientTestBase):
|
|||||||
"""Nova quotas functional tests.
|
"""Nova quotas functional tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
_quota_resources = ['instances', 'cores', 'ram',
|
_quota_resources = ['instances', 'cores', 'ram',
|
||||||
'floating_ips', 'fixed_ips', 'metadata_items',
|
'floating_ips', 'fixed_ips', 'metadata_items',
|
||||||
'injected_files', 'injected_file_content_bytes',
|
'injected_files', 'injected_file_content_bytes',
|
||||||
|
@ -24,6 +24,8 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
|
|||||||
This only exercises client commands that are read only.
|
This only exercises client commands that are read only.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def test_admin_fake_action(self):
|
def test_admin_fake_action(self):
|
||||||
self.assertRaises(exceptions.CommandFailed,
|
self.assertRaises(exceptions.CommandFailed,
|
||||||
self.nova,
|
self.nova,
|
||||||
|
@ -20,6 +20,8 @@ class TestServersBootNovaClient(base.ClientTestBase):
|
|||||||
"""Servers boot functional tests.
|
"""Servers boot functional tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def test_boot_server_with_legacy_bdm(self):
|
def test_boot_server_with_legacy_bdm(self):
|
||||||
volume_size = 1
|
volume_size = 1
|
||||||
volume_name = str(uuid.uuid4())
|
volume_name = str(uuid.uuid4())
|
||||||
@ -44,6 +46,8 @@ class TestServersListNovaClient(base.ClientTestBase):
|
|||||||
"""Servers list functional tests.
|
"""Servers list functional tests.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def _create_servers(self, name, number):
|
def _create_servers(self, name, number):
|
||||||
network = self.client.networks.list()[0]
|
network = self.client.networks.list()[0]
|
||||||
servers = []
|
servers = []
|
||||||
|
@ -32,6 +32,8 @@ def wait_for_delete(test, name, thing, get_func):
|
|||||||
|
|
||||||
class TestVolumesAPI(base.ClientTestBase):
|
class TestVolumesAPI(base.ClientTestBase):
|
||||||
|
|
||||||
|
COMPUTE_API_VERSION = "2.1"
|
||||||
|
|
||||||
def test_volumes_snapshots_types_create_get_list_delete(self):
|
def test_volumes_snapshots_types_create_get_list_delete(self):
|
||||||
# Create a volume
|
# Create a volume
|
||||||
volume = self.client.volumes.create(1)
|
volume = self.client.volumes.create(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user