Replace the usage of 'os' with 'os_primary'

Read-only property 'os' has moved to 'os_primary' in version 'Pike'
and will be removed in version 'Queens', so this is to replace
the usage of 'os' with 'os_primary'.

Change-Id: I9f7c13da05a8c4a63529c11aa6213a7269abee6d
This commit is contained in:
zhufl 2017-05-23 10:21:48 +08:00
parent fcefb26f2a
commit 0419088f9d
7 changed files with 19 additions and 18 deletions

View File

@ -178,16 +178,16 @@ requested credentials you can reference:
+-------------------+---------------------+
| Credentials Entry | Manager Variable |
+===================+=====================+
| primary | cls.os |
| primary | cls.os_primary |
+-------------------+---------------------+
| admin | cls.os_adm |
| admin | cls.os_admin |
+-------------------+---------------------+
| alt | cls.os_alt |
+-------------------+---------------------+
| [$label, $role] | cls.os_roles_$label |
+-------------------+---------------------+
By default cls.os is available since it is allocated in the base tempest test
By default cls.os_primary is available since it is allocated in the base tempest test
class (located in tempest/test.py). If your TestCase inherits from a different
direct parent class (it'll still inherit from the BaseTestCase, just not
directly) be sure to check if that class overrides allocated credentials.
@ -270,13 +270,13 @@ call to create a server in Nova::
class TestExampleCase(test.BaseTestCase):
def test_example_create_server(self):
self.os.servers_client.create_server(...)
self.os_primary.servers_client.create_server(...)
is all you need to do. As described previously, in the above example the ``self.os``
is created automatically because the base test class sets the ``credentials``
attribute to allocate a primary credential set and initializes the client
manager as ``self.os``. This same access pattern can be used for all of the
clients in Tempest.
is all you need to do. As described previously, in the above example the
``self.os_primary`` is created automatically because the base test class sets the
``credentials`` attribute to allocate a primary credential set and initializes
the client manager as ``self.os_primary``. This same access pattern can be used
for all of the clients in Tempest.
Credentials Objects
-------------------
@ -293,7 +293,7 @@ object via the manager's ``credentials`` attribute. For example::
class TestExampleCase(test.BaseTestCase):
def test_example_create_server(self):
credentials = self.os.credentials
credentials = self.os_primary.credentials
The credentials object provides access to all of the credential information you
would need to make API requests. For example, building off the previous
@ -304,7 +304,7 @@ example::
class TestExampleCase(test.BaseTestCase):
def test_example_create_server(self):
credentials = self.os.credentials
credentials = self.os_primary.credentials
username = credentials.username
user_id = credentials.user_id
password = credentials.password

View File

@ -151,7 +151,7 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest):
"""Tests that no networking is allocated for the server."""
# create the server with no networking
server, _ = compute.create_test_server(
self.os, networks='none', wait_until='ACTIVE')
self.os_primary, networks='none', wait_until='ACTIVE')
self.addCleanup(self.delete_server, server['id'])
# get the server ips
addresses = self.servers_client.list_addresses(
@ -176,7 +176,7 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest):
# - Third request sees net1 and net2 for the tenant and fails with a
# NetworkAmbiguous 400 error.
_, servers = compute.create_test_server(
self.os, networks='auto', wait_until='ACTIVE',
self.os_primary, networks='auto', wait_until='ACTIVE',
min_count=3)
server_nets = set()
for server in servers:

View File

@ -204,7 +204,7 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
kwargs['name'] = data_utils.rand_name(cls.__name__ + "-server")
tenant_network = cls.get_tenant_network()
body, servers = compute.create_test_server(
cls.os,
cls.os_primary,
validatable,
validation_resources=cls.validation_resources,
tenant_network=tenant_network,

View File

@ -264,7 +264,8 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
# create two servers
_, servers = compute.create_test_server(
self.os, tenant_network=network, wait_until='ACTIVE', min_count=2)
self.os_primary, tenant_network=network,
wait_until='ACTIVE', min_count=2)
# add our cleanups for the servers since we bypassed the base class
for server in servers:
self.addCleanup(self.delete_server, server['id'])

View File

@ -24,7 +24,7 @@ class MultipleCreateTestJSON(base.BaseV2ComputeTest):
def test_multiple_create(self):
tenant_network = self.get_tenant_network()
body, servers = compute.create_test_server(
self.os,
self.os_primary,
wait_until='ACTIVE',
min_count=2,
tenant_network=tenant_network)

View File

@ -224,7 +224,7 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
tenant_network = self.get_tenant_network()
body, _ = compute.create_test_server(
self.os,
self.os_primary,
tenant_network=tenant_network,
name=name,
**kwargs)

View File

@ -168,7 +168,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
cls.floating_ips = {}
cls.tenants = {}
cls.primary_tenant = cls.TenantProperties(cls.os)
cls.primary_tenant = cls.TenantProperties(cls.os_primary)
cls.alt_tenant = cls.TenantProperties(cls.os_alt)
for tenant in [cls.primary_tenant, cls.alt_tenant]:
cls.tenants[tenant.creds.tenant_id] = tenant