Change Murano API detection in tests and fix tests itself

- Use 401 error to determine work of Murano API in shell via curl
- Change tempest parameters in utils
- Rename mistralclient.py to workflowclient.py due names conflict in
path.

Closes-Bug: #1614602

Change-Id: I91bdda91da929b183393c4210af86bce619a53ec
This commit is contained in:
Victor Ryzhenkin 2016-08-05 20:37:08 +03:00 committed by Victor Ryzhenkin (freerunner)
parent 055cd06052
commit 66f310b227
4 changed files with 14 additions and 10 deletions

View File

@ -5,7 +5,7 @@
# How many seconds to wait for the API to be responding before giving up
API_RESPONDING_TIMEOUT=20
if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:8082/v1/ 2>/dev/null | grep -q 'Authentication required' ; do sleep 1; done"; then
if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:8082/v1/ 2>/dev/null | grep -q 'Unauthorized' ; do sleep 1; done"; then
echo "Murano API failed to respond within ${API_RESPONDING_TIMEOUT} seconds"
exit 1
fi

View File

@ -18,21 +18,21 @@ from murano.engine.system import agent_listener
from murano.engine.system import heat_stack
from murano.engine.system import instance_reporter
from murano.engine.system import logger
from murano.engine.system import mistralclient
from murano.engine.system import net_explorer
from murano.engine.system import resource_manager
from murano.engine.system import status_reporter
from murano.engine.system import test_fixture
from murano.engine.system import workflowclient
def register(package):
package.register_class(agent.Agent)
package.register_class(agent_listener.AgentListener)
package.register_class(heat_stack.HeatStack)
package.register_class(mistralclient.MistralClient)
package.register_class(resource_manager.ResourceManager)
package.register_class(instance_reporter.InstanceReportNotifier)
package.register_class(status_reporter.StatusReporter)
package.register_class(net_explorer.NetworkExplorer)
package.register_class(logger.Logger)
package.register_class(test_fixture.TestFixture)
package.register_class(workflowclient.MistralClient)

View File

@ -18,16 +18,19 @@ import json
import eventlet
try:
import mistralclient.api.client as mistralclient
from mistralclient.api import client as mistralcli
except ImportError as mistral_import_error:
mistralclient = None
mistralcli = None
from oslo_config import cfg
from oslo_log import log as logging
from murano.common import auth_utils
from murano.common.i18n import _LW
from murano.dsl import dsl
from murano.dsl import session_local_storage
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class MistralError(Exception):
@ -47,7 +50,8 @@ class MistralClient(object):
@staticmethod
@session_local_storage.execution_session_memoize
def _create_client(region):
if not mistralclient:
if not mistralcli:
LOG.warning(_LW("Mistral client is not available"))
raise mistral_import_error
mistral_settings = CONF.mistral
@ -62,7 +66,7 @@ class MistralClient(object):
region_name=region)
auth_ref = session.auth.get_access(session)
return mistralclient.client(
return mistralcli.client(
mistral_url=mistral_url,
project_id=auth_ref.project_id,
endpoint_type=endpoint_type,
@ -78,7 +82,7 @@ class MistralClient(object):
def run(self, name, timeout=600, inputs=None, params=None):
execution = self._client.executions.create(
workflow_name=name, workflow_input=inputs, params=params)
workflow_identifier=name, workflow_input=inputs, params=params)
# For the fire and forget functionality - when we do not want to wait
# for the result of the run.
if timeout == 0:

View File

@ -30,7 +30,7 @@ class TempestDeployTestMixin(common_utils.DeployTestMixin):
def keystone_client():
return ksclient.Client(username=CONF.auth.admin_username,
password=CONF.auth.admin_password,
tenant_name=CONF.auth.admin_tenant_name,
tenant_name=CONF.auth.admin_project_name,
auth_url=CONF.identity.uri)
@staticmethod
@ -40,7 +40,7 @@ class TempestDeployTestMixin(common_utils.DeployTestMixin):
auth_url=CONF.identity.uri,
username=CONF.auth.admin_username,
password=CONF.auth.admin_password,
tenant_name=CONF.auth.admin_tenant_name)
tenant_name=CONF.auth.admin_project_name)
session = keystoneclient.session.Session(auth=auth)
return cclient.Client(session=session,
service_type='policy')