Fixed issues with review comments.

This commit is contained in:
Timur Nurlygayanov 2013-09-19 13:24:18 +04:00
parent 69d2e897d2
commit fc16de8023
5 changed files with 31 additions and 14 deletions

View File

@ -28,6 +28,7 @@ import cinderclient.client
import glanceclient.client import glanceclient.client
import keystoneclient.v2_0.client import keystoneclient.v2_0.client
import novaclient.client import novaclient.client
import muranoclient.v1.client
from fuel_health import exceptions from fuel_health import exceptions
@ -136,6 +137,14 @@ class CleanUpClientManager(fuel_health.manager.Manager):
auth_url=auth_url, auth_url=auth_url,
insecure=dscv) insecure=dscv)
def _get_murano_client()
token_id = self.manager._get_identity_client().auth_token
api_host = self.config.murano.api_url
insecure = self.config.murano.insecure
return muranoclient.v1.client.Client(endpoint=api_host, token=token_id,
insecure=insecure)
def wait_for_server_termination(self, server, ignore_error=False): def wait_for_server_termination(self, server, ignore_error=False):
"""Waits for server to reach termination.""" """Waits for server to reach termination."""
start_time = int(time.time()) start_time = int(time.time())
@ -288,6 +297,15 @@ def cleanup():
LOG.debug(exc) LOG.debug(exc)
pass pass
environments = manager._get_murano_client().environments.list()
for environment in environments:
if environment['name'].startswith('ost1_test-'):
try:
LOG.info('start environment deletion')
manager._get_murano_client().environments.delete(environment['id'])
except Exception as exc:
LOG.debug(exc)
pass
if __name__ == "__main__": if __name__ == "__main__":
cleanup() cleanup()

View File

@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from muranoclient.v1.client import Client import muranoclient.v1.client
import nmanager import nmanager
@ -72,9 +72,9 @@ class MuranoTest(nmanager.OfficialClientTest):
""" """
This method returns Murano API client This method returns Murano API client
""" """
return Client(endpoint=self.api_host, return muranoclient.v1.client.Client(endpoint=self.api_host,
token=self.token_id, token=self.token_id,
insecure=self.insecure) insecure=self.insecure)
def verify_elements_list(self, elements, attrs, msg='', failed_step=''): def verify_elements_list(self, elements, attrs, msg='', failed_step=''):
""" """
@ -88,7 +88,7 @@ class MuranoTest(nmanager.OfficialClientTest):
if failed_step: if failed_step:
msg = ('Step %s failed: ' % str(failed_step)) + msg msg = ('Step %s failed: ' % str(failed_step)) + msg
if len(elements) == 0: if not elements:
self.fail(msg) self.fail(msg)
for element in elements: for element in elements:
@ -246,9 +246,9 @@ class MuranoTest(nmanager.OfficialClientTest):
Returns specific service. Returns specific service.
""" """
url = '/' + str(service_id) return self.murano_client.services.get(environment_id,
'/{0}'.format(service_id),
return self.murano_client.services.get(environment_id, url, session_id) session_id)
def delete_service(self, environment_id, session_id, service_id): def delete_service(self, environment_id, session_id, service_id):
""" """
@ -262,7 +262,6 @@ class MuranoTest(nmanager.OfficialClientTest):
Returns None. Returns None.
""" """
url = '/' + str(service_id) return self.murano_client.services.delete(environment_id,
'/{0}'.format(service_id),
return self.murano_client.services.delete(environment_id, url,
session_id) session_id)

View File

@ -33,7 +33,7 @@ class ServicesTestJSON(murano.MuranoTest):
Duration: 5 s. Duration: 5 s.
""" """
fail_msg = 'User can not get list of environments.' fail_msg = 'Environments list is unavailable.'
environments = self.verify(5, self.list_environments, environments = self.verify(5, self.list_environments,
2, fail_msg, "environments listing") 2, fail_msg, "environments listing")

View File

@ -24,7 +24,7 @@ python-keystoneclient==0.3.1
python-mimeparse==0.1.4 python-mimeparse==0.1.4
python-novaclient==2.13.0 python-novaclient==2.13.0
python-neutronclient>=2.2 python-neutronclient>=2.2
python-muranoclient python-muranoclient>=0.2
requests==1.2.3 requests==1.2.3
setuptools-git==1.0 setuptools-git==1.0
simplejson==3.3.0 simplejson==3.3.0

View File

@ -28,7 +28,7 @@ requirements = [
'python-mimeparse==0.1.4', 'python-mimeparse==0.1.4',
'python-novaclient==2.13.0', 'python-novaclient==2.13.0',
'python-neutronclient>=2.2', 'python-neutronclient>=2.2',
'python-muranoclient', 'python-muranoclient>=0.2',
'requests==1.2.3', 'requests==1.2.3',
'setuptools-git==1.0', 'setuptools-git==1.0',
'simplejson==3.3.0', 'simplejson==3.3.0',