Convergence: Run scenario tests synchronously
The convergence scenario tests run the stack CRUD operations using engine service and the service runs the functions in another thread. This causes issues as the convergence scenario tests expect functions to be run synchronously. Change-Id: I065ea6dad5ac0ee9d3d233d3d807acecbed7b98f
This commit is contained in:
parent
1f2cb45040
commit
0f48b1d66c
|
@ -22,6 +22,17 @@ from heat.tests.convergence.framework import scenario_template
|
||||||
from heat.tests import utils
|
from heat.tests import utils
|
||||||
|
|
||||||
|
|
||||||
|
class SynchronousThreadGroupManager(service.ThreadGroupManager):
|
||||||
|
"""Wrapper for thread group manager.
|
||||||
|
|
||||||
|
The start method of thread group manager needs to be overriden to
|
||||||
|
run the function synchronously so that the convergence scenario
|
||||||
|
tests can run.
|
||||||
|
"""
|
||||||
|
def start(self, stack_id, func, *args, **kwargs):
|
||||||
|
func(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Engine(message_processor.MessageProcessor):
|
class Engine(message_processor.MessageProcessor):
|
||||||
"""Wrapper to the engine service.
|
"""Wrapper to the engine service.
|
||||||
|
|
||||||
|
@ -63,8 +74,7 @@ class Engine(message_processor.MessageProcessor):
|
||||||
def create_stack(self, stack_name, scenario_tmpl):
|
def create_stack(self, stack_name, scenario_tmpl):
|
||||||
cnxt = utils.dummy_context()
|
cnxt = utils.dummy_context()
|
||||||
srv = service.EngineService("host", "engine")
|
srv = service.EngineService("host", "engine")
|
||||||
thread_group_mgr = service.ThreadGroupManager()
|
srv.thread_group_mgr = SynchronousThreadGroupManager()
|
||||||
srv.thread_group_mgr = thread_group_mgr
|
|
||||||
hot_tmpl = self.scenario_template_to_hot(scenario_tmpl)
|
hot_tmpl = self.scenario_template_to_hot(scenario_tmpl)
|
||||||
srv.create_stack(cnxt, stack_name, hot_tmpl,
|
srv.create_stack(cnxt, stack_name, hot_tmpl,
|
||||||
params={}, files={}, environment_files=None, args={})
|
params={}, files={}, environment_files=None, args={})
|
||||||
|
@ -74,8 +84,7 @@ class Engine(message_processor.MessageProcessor):
|
||||||
cnxt = utils.dummy_context()
|
cnxt = utils.dummy_context()
|
||||||
db_stack = db_api.stack_get_by_name(cnxt, stack_name)
|
db_stack = db_api.stack_get_by_name(cnxt, stack_name)
|
||||||
srv = service.EngineService("host", "engine")
|
srv = service.EngineService("host", "engine")
|
||||||
thread_group_mgr = service.ThreadGroupManager()
|
srv.thread_group_mgr = SynchronousThreadGroupManager()
|
||||||
srv.thread_group_mgr = thread_group_mgr
|
|
||||||
hot_tmpl = self.scenario_template_to_hot(scenario_tmpl)
|
hot_tmpl = self.scenario_template_to_hot(scenario_tmpl)
|
||||||
stack_identity = {'stack_name': stack_name,
|
stack_identity = {'stack_name': stack_name,
|
||||||
'stack_id': db_stack.id,
|
'stack_id': db_stack.id,
|
||||||
|
@ -93,6 +102,7 @@ class Engine(message_processor.MessageProcessor):
|
||||||
'tenant': db_stack.tenant,
|
'tenant': db_stack.tenant,
|
||||||
'path': ''}
|
'path': ''}
|
||||||
srv = service.EngineService("host", "engine")
|
srv = service.EngineService("host", "engine")
|
||||||
|
srv.thread_group_mgr = SynchronousThreadGroupManager()
|
||||||
srv.delete_stack(cnxt, stack_identity)
|
srv.delete_stack(cnxt, stack_identity)
|
||||||
|
|
||||||
@message_processor.asynchronous
|
@message_processor.asynchronous
|
||||||
|
|
Loading…
Reference in New Issue