Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add more tests #13

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ before_script:
- cd ansible-$ROLE_NAME

script:
- molecule --debug test --all
- ./runMolecule.sh

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
28 changes: 28 additions & 0 deletions runMolecule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add some short description of the purpose of the file and how to use it in 'must succes' and 'must fail scenarios'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion, added

SCENARIOS="default signature"

MUST_FAIL=""

function has_right_to_fail {
for i in ${MUST_FAIL}; do
if [ "${MOLECULE_DISTRO}:${1}" = "${i}" ]; then
return 1
fi
done
return 0
}

for scenario in ${SCENARIOS}; do
molecule test -s ${scenario}
RETURN_SCENARIO=$?
has_right_to_fail ${scenario}
RIGHT_TO_FAIL=$?
if [ ${RETURN_SCENARIO} -gt 0 ] && [ ${RIGHT_TO_FAIL} -eq 0 ]; then
exit ${RETURN_SCENARIO}
fi;

if [ ${RETURN_SCENARIO} -eq 0 ] && [ ${RIGHT_TO_FAIL} -eq 1 ]; then
echo "${MOLECULE_DISTRO} on ${scenario} must fail"
exit 1;
fi
done