Fix SSHActionsTestsV2 failure

ServersClient class doesn't exists in tempest.clients module, so
the error below occurs for unit test SSHActionsTestsV2:

File "/opt/stack/new/mistral/mistral_tempest_tests/tests/base.py",
line 78, in resource_setup
AttributeError: 'module' object has no attribute 'ServersClient'

We should use service clients initialized in tempest credential setup.

Change-Id: I09dea2f596abab9987221ff9d79a065d269f73a9
This commit is contained in:
Lingxian Kong 2016-06-28 23:28:53 +12:00
parent 25d52da83a
commit a7b8f496b3
2 changed files with 7 additions and 14 deletions

View File

@ -15,7 +15,6 @@
import os
import mock
from tempest import clients
from tempest import config
from tempest import test as test
@ -75,12 +74,6 @@ class TestCaseAdvanced(TestCase):
def resource_setup(cls):
super(TestCaseAdvanced, cls).resource_setup()
cls.server_client = clients.ServersClient(
cls.mgr.auth_provider,
"compute",
region=CONF.identity.region
)
cls.image_ref = CONF.compute.image_ref
cls.flavor_ref = CONF.compute.flavor_ref

View File

@ -64,7 +64,7 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
@classmethod
def _create_server(cls, server_name, **kwargs):
return cls.server_client.create_server(
return cls.mgr.servers_client.create_server(
name=server_name,
imageRef=CONF.compute.image_ref,
flavorRef=CONF.compute.flavor_ref,
@ -126,7 +126,7 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
LOG.info("Waiting server [id=%s]..." % server_id)
while seconds_remain > 0:
server_info = cls.server_client.show_server(server_id)
server_info = cls.mgr.servers_client.show_server(server_id)
if server_info['server']['status'] == 'ACTIVE':
return
@ -145,7 +145,7 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
while seconds_remain > 0:
try:
cls.server_client.show_server(server_id)
cls.mgr.servers_client.show_server(server_id)
seconds_remain -= delay
time.sleep(delay)
except exceptions.NotFound:
@ -214,11 +214,11 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
cls._wait_until_server_up(cls.public_vm_ip)
# Update servers info.
cls.public_vm = cls.server_client.show_server(
cls.public_vm = cls.mgr.servers_client.show_server(
cls.public_vm['id']
).get('server')
cls.guest_vm = cls.server_client.show_server(
cls.guest_vm = cls.mgr.servers_client.show_server(
cls.guest_vm['id']
).get('server')
@ -230,8 +230,8 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
cls.public_vm['id']
)
cls.server_client.delete_server(cls.public_vm['id'])
cls.server_client.delete_server(cls.guest_vm['id'])
cls.mgr.servers_client.delete_server(cls.public_vm['id'])
cls.mgr.servers_client.delete_server(cls.guest_vm['id'])
cls._wait_until_server_delete(cls.public_vm['id'])
cls._wait_until_server_delete(cls.guest_vm['id'])