run_tests.sh was updated to version 2019.01.07
Script source: https://gerrit.mcp.mirantis.com/#/admin/projects/salt-formulas/cookiecutter-salt-formula
Change-Id: I507867f3ebafebd0efc86afd7f8b1be14abb0622
Related-PROD: PROD-26201
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 461fd8b..4665d34 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -5,7 +5,7 @@
# Script requirments:
#apt-get install -y python-yaml virtualenv git
-__ScriptVersion="2018.11.21"
+__ScriptVersion="2019.01.07"
__ScriptName="run_tests.sh"
__ScriptFullName="$0"
__ScriptArgs="$*"
@@ -77,6 +77,12 @@
state_name=$(basename ${pillar%.sls})
echo -e " ${state_name}:\n - ${state_name}" >> ${SALT_PILLAR_DIR}/top.sls
done
+ for pillar in $(find $PILLARDIR -mindepth 2 -type f -iname *.sls); do
+ state_name=$(basename "${pillar%*.sls}")
+ os_release=$(echo $pillar | rev | cut -d'/' -f2 | rev)
+ grep ${FORMULA_NAME}: ${pillar} &>/dev/null || continue
+ echo -e " ${os_release}_${state_name}:\n - ${os_release}.${state_name}" >> ${SALT_PILLAR_DIR}/top.sls
+ done
}
setup_salt() {
@@ -91,6 +97,12 @@
state_name=$(basename ${pillar%.sls})
echo -e " ${state_name}:\n - ${FORMULA_NAME}" >> ${SALT_FILE_DIR}/top.sls
done
+ for pillar in $(find $PILLARDIR -mindepth 2 -type f -iname *.sls); do
+ state_name=$(basename "${pillar%*.sls}")
+ os_release=$(echo $pillar | rev | cut -d'/' -f2 | rev)
+ grep ${FORMULA_NAME}: ${pillar} &>/dev/null || continue
+ echo -e " ${os_release}_${state_name}:\n - ${FORMULA_NAME}" >> ${SALT_FILE_DIR}/top.sls
+ done
cat << EOF > ${SALT_CONFIG_DIR}/minion
file_client: local
@@ -226,7 +238,7 @@
fetch_dependency "salt:https://github.com/salt-formulas/salt-formula-salt"
link_modules
salt_run saltutil.clear_cache; salt_run saltutil.refresh_pillar; salt_run saltutil.sync_all;
- for role in ${SCHEMARDIR}/*.yaml; do
+ for role in $(find $SCHEMARDIR/* -maxdepth 0 -type f -iname *.yaml); do
role_name=$(basename "${role%*.yaml}")
for pillar in $(ls pillar/${role_name}*.sls | grep -v ${IGNORE_MODELVALIDATE_MASK} ); do
pillar_name=$(basename "${pillar%*.sls}")
@@ -237,6 +249,13 @@
salt_run -m ${DEPSDIR}/salt-formula-salt --id=${pillar_name} modelschema.model_validate ${FORMULA_NAME} ${role_name} || { log_err "Execution of model_validate ${_message} failed"; exit 1 ; }
done
done
+ for schema in $(find $SCHEMARDIR -mindepth 2 -type f -iname *.yaml); do
+ role_name=$(basename "${schema%*.yaml}")
+ os_release=$(echo $schema | rev | cut -d'/' -f2 | rev)
+ local _message="FORMULA:${FORMULA_NAME} ROLE:${role_name} against PILLAR:${role_name}"
+ log_info "model_validate ${_message}"
+ salt_run -m ${DEPSDIR}/salt-formula-salt --id=${os_release}_${role_name} modelschema.model_validate ${FORMULA_NAME} ${role_name} ${os_release} || { log_err "Execution of model_validate ${_message} failed"; exit 1 ; }
+ done
else
log_info "${SCHEMARDIR} not found!";
fi