added a new realcase scenario to rally and clean leftovers

-added another new big workflow scenario (Terminate) to rally
  scenarios, this will help us in the future benchmark mistral
  and notice performance regressions if they happen.

 -delete leftovers (workflows,actions) after the scenario has
  finished running.


Change-Id: I3f1e37c43c6d87a678e0ffaa0fcbd607a27dbc7b
Signed-off-by: ali <ali.abdelal@nokia.com>
This commit is contained in:
ali 2020-05-03 13:31:58 +00:00 committed by Eyal
parent f57d49f52c
commit 1f9e1c1f0a
2 changed files with 37 additions and 6 deletions

View File

@ -15,8 +15,6 @@
import json import json
from pathlib import Path from pathlib import Path
import random
import string
from rally.common import cfg from rally.common import cfg
from rally.task import validation from rally.task import validation
@ -39,9 +37,11 @@ class MistralHugeWorkflowScenario(utils.MistralScenario):
main_wf_file_name = '' main_wf_file_name = ''
params_filename = '' params_filename = ''
wf_name = '' wf_name = ''
created_wfs = []
created_wbs = []
def run(self): def run(self):
namespace = ''.join(random.choices(string.ascii_lowercase)) namespace = ''
CONF.openstack.mistral_execution_timeout = SCENARIO_TIMEOUT_SEC CONF.openstack.mistral_execution_timeout = SCENARIO_TIMEOUT_SEC
self.create_common_workflows() self.create_common_workflows()
@ -50,18 +50,31 @@ class MistralHugeWorkflowScenario(utils.MistralScenario):
params = self._read_params_from_file() params = self._read_params_from_file()
self.run_workflow(params, namespace=namespace) self.run_workflow(params, namespace=namespace)
self.clean_after_scenario(namespace=namespace)
def clean_after_scenario(self, namespace=''):
for wf in self.created_wfs:
self._delete_workflow(wf, namespace=namespace)
for wb in self.created_wbs:
self._delete_workbook(wb, namespace=namespace)
def create_common_workflows(self): def create_common_workflows(self):
for file in common_workflow_files: for file in common_workflow_files:
with open(wf_dir + file, 'r+') as f: with open(wf_dir + file, 'r+') as f:
definition = f.read() definition = f.read()
self._create_workflow(definition) wfs = self._create_workflow(definition)
for wf in wfs:
self.created_wfs.append(wf.name)
def create_actions(self): def create_actions(self):
for file in action_files: for file in action_files:
with open(wf_dir + file, 'r+') as f: with open(wf_dir + file, 'r+') as f:
definition = f.read() definition = f.read()
self._create_workbook(definition) wb = self._create_workbook(definition)
self.created_wbs.append(wb.name)
def _create_workbook(self, definition, namespace=''): def _create_workbook(self, definition, namespace=''):
return self.clients("mistral").workbooks.create( return self.clients("mistral").workbooks.create(
@ -89,7 +102,10 @@ class MistralHugeWorkflowScenario(utils.MistralScenario):
def create_main_workflow(self, namespace=''): def create_main_workflow(self, namespace=''):
with open(wf_dir + self.main_wf_file_name, 'r+') as f: with open(wf_dir + self.main_wf_file_name, 'r+') as f:
definition = f.read() definition = f.read()
self._create_workflow(definition, namespace=namespace) wfs = self._create_workflow(definition, namespace=namespace)
for wf in wfs:
self.created_wfs.append(wf.name)
@validation.add("required_platform", platform="openstack", users=True) @validation.add("required_platform", platform="openstack", users=True)

View File

@ -15,6 +15,21 @@
failure_rate: failure_rate:
max: 0 max: 0
MistralExecutions.TerminateScenario:
-
runner:
type: "constant"
times: 1
concurrency: 1
timeout: 17000
context:
users:
tenants: 1
users_per_tenant: 1
sla:
failure_rate:
max: 0
MistralWorkbooks.list_workbooks: MistralWorkbooks.list_workbooks:
- -
runner: runner: