Merge "Add SaltModelTesting.testCCModel"
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index 43d1869..2d8c8e8 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -254,7 +254,7 @@
* @param ext_variables The list of external variables
* @param results The reports directory
*/
-def runRallyTests(master, target, dockerImageLink, platform, output_dir, repository, branch, scenarios = '', tasks_args_file = '', ext_variables = [], results = '/root/qa_results') {
+def runRallyTests(master, target, dockerImageLink, platform, output_dir, repository, branch, scenarios = '', tasks_args_file = '', ext_variables = [], results = '/root/qa_results', skip_list = '') {
def salt = new com.mirantis.mk.Salt()
def output_file = 'docker-rally.log'
def dest_folder = '/home/rally/qa_results'
@@ -266,6 +266,8 @@
def cmd_rally_task_args = ''
def cmd_report = "rally task export --type junit-xml --to ${dest_folder}/report-rally.xml; " +
"rally task report --out ${dest_folder}/report-rally.html"
+ def cmd_skip_names = ''
+ def cmd_skip_dirs = ''
salt.runSaltProcessStep(master, target, 'file.remove', ["${results}"])
salt.runSaltProcessStep(master, target, 'file.mkdir', ["${results}", "mode=777"])
if (platform == 'openstack') {
@@ -289,13 +291,25 @@
'rally deployment create --fromenv --name=existing; ' +
'rally deployment config; '
cmd_rally_checkout = "git clone -b ${branch ?: 'master'} ${repository} test_config; "
+ if (skip_list != ''){
+ for ( scen in skip_list.split(',') ) {
+ if ( scen.contains('yaml')) {
+ cmd_skip_names += "! -name ${scen} "
+ }
+ else {
+ cmd_skip_dirs += "-path ${scenarios}/${scen} -prune -o "
+ }
+ }
+ }
if (scenarios == '') {
cmd_rally_start = "rally $rally_extra_args task start test_config/rally/scenario.yaml "
} else {
cmd_rally_start = "rally $rally_extra_args task start scenarios.yaml "
cmd_rally_checkout += "if [ -f ${scenarios} ]; then cp ${scenarios} scenarios.yaml; " +
"else " +
- "find -L ${scenarios} -name '*.yaml' -exec cat {} >> scenarios.yaml \\; ; " +
+ "find -L ${scenarios} " + cmd_skip_dirs +
+ " -name '*.yaml' " + cmd_skip_names +
+ "-exec cat {} >> scenarios.yaml \\; ; " +
"sed -i '/---/d' scenarios.yaml; fi; "
}
}
@@ -327,9 +341,10 @@
writeFile file: "${tmp_dir}/k8s-client.crt", text: k8s_client_crt
salt.cmdRun(master, target, "mv ${tmp_dir}/* ${results}/")
salt.runSaltProcessStep(master, target, 'file.rmdir', ["${tmp_dir}"])
- cmd_rally_init = 'set -e ; set -x; if [ ! -w ~/.rally ]; then sudo chown rally:rally ~/.rally ; fi; cd /tmp/; ' +
+ cmd_rally_init = 'set -e ; set -x; cd /tmp/; ' +
"git clone -b ${plugins_branch ?: 'master'} ${plugins_repo} plugins; " +
"sudo pip install --upgrade ./plugins; " +
+ "rally db recreate; " +
"rally env create --name k8s --from-sysenv; " +
"rally env check k8s; "
if (repository == '' ) {
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index d513822..1dacc11 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -204,7 +204,7 @@
// Install docker
if (salt.testTarget(master, "I@docker:host ${extra_tgt}")) {
salt.enforceState(master, "I@docker:host ${extra_tgt}", 'docker.host', true, true, null, false, -1, 3)
- salt.cmdRun(master, "I@docker:host:enabled:true ${extra_tgt}", 'docker ps')
+ salt.cmdRun(master, "I@docker:host and I@docker:host:enabled:true ${extra_tgt}", 'docker ps')
}
// Install keepalived
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 6530062..f7724a6 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -248,12 +248,20 @@
def node = out["return"][i];
for(int j=0;j<node.size();j++){
def nodeKey = node.keySet()[j]
- if (!node[nodeKey].contains("Salt command execution success")) {
- throw new Exception("Execution of cmd ${originalCmd} failed. Server returns: ${node[nodeKey]}")
+ if (node[nodeKey] instanceof String) {
+ if (!node[nodeKey].contains("Salt command execution success")) {
+ throw new Exception("Execution of cmd ${originalCmd} failed. Server returns: ${node[nodeKey]}")
+ }
+ } else if (node[nodeKey] instanceof Boolean) {
+ if (!node[nodeKey]) {
+ throw new Exception("Execution of cmd ${originalCmd} failed. Server returns: ${node[nodeKey]}")
+ }
+ } else {
+ throw new Exception("Execution of cmd ${originalCmd} failed. Server returns unexpected data type: ${node[nodeKey]}")
}
}
}
- }else{
+ } else {
throw new Exception("Salt Api response doesn't have return param!")
}
}