kayobe/tools/test-molecule.sh
Mark Goddard 428ef10fa4 Use merge_configs and merge_yaml to generate Kolla custom config
This patch adds new functionality - merging base & environment specific
kolla config. This allows you to place common settings in the base
configuration and only keep environment specific settings in the
environment directories.

Change-Id: Id4588f4529a4522e68e22ce58711cb927fa68a9d
Story: 2002009
Task: 42903
2023-05-30 16:47:14 +00:00

38 lines
957 B
Bash
Executable File

#!/bin/bash
# Run molecule tests. Any arguments passed to this script will be passed onto
# molecule.
set -e
molecules="$(find ansible/roles/ -name molecule -type d)"
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# FIXME: doesn't get passed through to linter.
export ANSIBLE_ACTION_PLUGINS="$PARENT/../kayobe/plugins/action:~/.ansible/plugins/action:/usr/share/ansible/plugins/action"
export ANSIBLE_FORCE_COLOR=True
failed=0
ran=0
for molecule in $molecules; do
pushd $(dirname $molecule)
# Don't run molecule tests from Galaxy roles.
if [[ -f meta/.galaxy_install_info ]]; then
echo "Skipping $(basename $(pwd)) as it is a Galaxy role"
popd
continue
fi
if ! molecule test --all $*; then
failed=$((failed + 1))
fi
ran=$((ran + 1))
popd
done
if [[ $failed -ne 0 ]]; then
echo "Failed $failed / $ran molecule tests"
exit 1
fi
echo "Ran $ran molecule tests successfully"