Workaround k8s rally getting stuck on large scenarios
Change-Id: I3b68e02b6a1392278dfed4033f6257a0daa45fb6
Related-bug: https://mirantis.jira.com/browse/PROD-23603
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index a1641b9..584cba6 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -371,7 +371,7 @@
* @param skip_scenarios Comma-delimited list of scenarios names to skip
* @param bundle_file Bundle name to create
*/
-def bundle_up_scenarios(scenarios_path, skip_scenarios, bundle_file) {
+def bundle_up_scenarios(scenarios_path, skip_scenarios, bundle_file = '' ) {
def skip_names = ''
def skip_dirs = ''
def result = ''
@@ -385,12 +385,17 @@
}
}
}
- result = "if [ -f ${scenarios_path} ]; then cp ${scenarios_path} ${bundle_file}; " +
+ if (bundle_file != '') {
+ result = "if [ -f ${scenarios_path} ]; then cp ${scenarios_path} ${bundle_file}; " +
"else " +
"find -L ${scenarios_path} " + skip_dirs +
" -name '*.yaml' " + skip_names +
"-exec cat {} >> ${bundle_file} \\; ; " +
"sed -i '/---/d' ${bundle_file}; fi; "
+ } else {
+ result = "find -L ${scenarios_path} " + skip_dirs +
+ " -name '*.yaml' " + skip_names
+ }
return result
}
@@ -483,20 +488,26 @@
} else {
throw new Exception("Platform ${platform} is not supported yet")
}
- cmd_rally_checkout += bundle_up_scenarios(scenarios, skip_list, "scenarios_${platform.type}.yaml")
- cmd_rally_start = "rally $rally_extra_args task start scenarios_${platform.type}.yaml "
- if (config_repo != '' ) {
- switch(tasks_args_file) {
- case 'none':
- cmd_rally_task_args = '; '
- break
- case '':
- cmd_rally_task_args = '--task-args-file test_config/job-params-light.yaml; '
- break
- default:
- cmd_rally_task_args = "--task-args-file ${tasks_args_file}; "
+ switch(tasks_args_file) {
+ case 'none':
+ cmd_rally_task_args = '; '
break
- }
+ case '':
+ cmd_rally_task_args = '--task-args-file test_config/job-params-light.yaml; '
+ break
+ default:
+ cmd_rally_task_args = "--task-args-file ${tasks_args_file}; "
+ break
+ }
+ if (platform['type'] == 'k8s') {
+ cmd_rally_start = "for task in \\\$(" + bundle_up_scenarios(scenarios, skip_list) +
+ "); do " +
+ "rally $rally_extra_args task start \\\$task ${cmd_rally_task_args}" +
+ "done; "
+ } else {
+ cmd_rally_checkout += bundle_up_scenarios(scenarios, skip_list, "scenarios_${platform.type}.yaml")
+ cmd_rally_start = "rally $rally_extra_args task start " +
+ "scenarios_${platform.type}.yaml ${cmd_rally_task_args}"
}
cmd_rally_report= "rally task export --uuid \\\$(rally task list --uuids-only --status finished) " +
"--type junit-xml --to ${dest_folder}/report-rally.xml; " +
@@ -506,7 +517,7 @@
full_cmd = 'set -xe; ' + cmd_rally_plugins +
cmd_rally_init + cmd_rally_checkout +
'set +e; ' + cmd_rally_start +
- cmd_rally_task_args + cmd_rally_stacklight +
+ cmd_rally_stacklight +
cmd_rally_report
salt.runSaltProcessStep(master, target, 'file.touch', ["${results}/rally.db"])
salt.cmdRun(master, target, "chmod 666 ${results}/rally.db")