1
0
Fork 0
salty-dog/scripts/test-examples.sh

24 lines
545 B
Bash
Raw Normal View History

# for each file in examples
EXAMPLES="$(find examples -name '*.yml')"
while read -r example;
do
EXPECTED_STATUS="$(grep '# test exit-status' "${example}" | sed 's/# test exit-status \([0-9]*\)/\1/')"
echo "Testing: ${example} (should be ${EXPECTED_STATUS})"
node out/index.js --rules rules/kubernetes.yml --tag kubernetes --source ${example}
ACTUAL_STATUS=$?
if [[ ${ACTUAL_STATUS} != ${EXPECTED_STATUS} ]];
then
echo "Status does not match!"
exit 1
fi
done <<< "${EXAMPLES}"
# read pragmas:
# rules
# tags
# run