-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support running the molecule tests against more versions of Ansible. By typing LSR_ANSIBLE_DEP=<ansible> LSR_MSCENARIO=<scenario> tox -e molecule one can run molecule inside tox with <ansible> version installed under <scenario> scenario. For example LSR_ANSIBLE_DEP='ansible==2.7.*' LSR_MSCENARIO=foo tox -e molecule will run molecule under scenario 'foo' and the recent Ansible 2.7 installed. `tox -e molecule` run molecule under default scenario with the latest Ansible (from pypi) installed. Travis runs molecule tests for Ansible 2.6, 2.7, and 2.8 installed and under default scenario (can be overriden by user in config.sh). Additional changes: Remove useless comment from custom.sh.
- Loading branch information
Showing
5 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,45 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: MIT | ||
|
||
set -ex | ||
# Run tox. Additionally, if LSR_MSCENARIOS is defined, run `tox -e molecule` | ||
# for every scenario from LSR_MSCENARIOS and for every Ansible version from | ||
# LSR_ANSIBLES. | ||
# | ||
# LSR_MSCENARIOS is a space separated list of molecule scenarios. | ||
# LSR_ANSIBLES is a space separated list of Ansible package names with versions | ||
# in pip format, i.e 'ansible ansible==2.6 ansible==2.7 ansible=2.8'. | ||
# | ||
# LSR_MSCENARIOS and LSR_ANSIBLES can be set in .travis/config.sh or as | ||
# environment variables. | ||
|
||
SCRIPTDIR=$(dirname $0) | ||
CONFIG=${SCRIPTDIR}/config.sh | ||
ME=$(basename $0) | ||
SCRIPTDIR=$(readlink -f $(dirname $0)) | ||
BANNERSIZE=90 | ||
|
||
if [[ -f ${CONFIG} ]]; then | ||
. ${CONFIG} | ||
. ${SCRIPTDIR}/utils.sh | ||
. ${SCRIPTDIR}/config.sh | ||
|
||
lsr_banner "tox" ${BANNERSIZE} | ||
(set -x; tox); error_code=$? | ||
|
||
# Exit prematurely if the environment is not suitable for running | ||
# Molecule tests. | ||
if ! lsr_venv_python_matches_system_python; then | ||
exit $error_code | ||
fi | ||
|
||
tox "$@" | ||
for X in ${LSR_MSCENARIOS}; do | ||
LSR_MSCENARIO=${X} tox -e molecule | ||
for ansible_dependency in ${LSR_ANSIBLES}; do | ||
for molecule_scenario in ${LSR_MSCENARIOS}; do | ||
lsr_banner \ | ||
"[${ansible_dependency}] tox -e molecule -- -s ${molecule_scenario}" \ | ||
${BANNERSIZE} | ||
( | ||
set -x | ||
LSR_ANSIBLE_DEP="${ansible_dependency}" \ | ||
LSR_MSCENARIO=${molecule_scenario} \ | ||
tox -e molecule | ||
) || error_code=$? | ||
done | ||
done | ||
|
||
exit $error_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters