Skip to content
Merged
Changes from all commits
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
22 changes: 14 additions & 8 deletions hack/openstack/test-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ declare \
os_cloud='' \
external_network='' \
compute_flavor='' \
persist='NO'
persist='NO' \
run='.*' \
test_counter=0

# Let install-config describe a configuration that is incompatible with the
# target CI infrastructure
Expand All @@ -32,10 +34,11 @@ print_help() {
echo -e "\\t${0} -c <cloud> -e <external network> -f <flavor> [-a <fip>] [-i <openshift-install>] [-t <test-dir>] [-p]"
echo
echo -e 'Additional arguments:'
echo -e "\\t-a\\tapiFloatingIP"
echo -e "\\t-i\\tpath to openshift-install (defaults to '${openshift_install}')"
echo -e "\\t-t\\tpath to the tests to be run (defaults to '${tests_dir}')"
echo -e "\\t-p\\tpersist artifacts: do not delete files generated by openshift-install"
echo -e "\\t-a\\t\\tapiFloatingIP"
echo -e "\\t-i\\t\\tpath to openshift-install (defaults to '${openshift_install}')"
echo -e "\\t-t\\t\\tpath to the tests to be run (defaults to '${tests_dir}')"
echo -e "\\t-p\\t\\tpersist artifacts: do not delete files generated by openshift-install"
echo -e "\\t-r <regexp>\\trun: only run test cases that match the given regular expression"
}

fill_install_config() {
Expand Down Expand Up @@ -70,7 +73,7 @@ validate_configuration() {
fi
}

while getopts a:c:e:f:i:t:ph o; do
while getopts a:c:e:f:i:t:pr:h o; do
case "$o" in
a) api_fip="$OPTARG" ;;
c) os_cloud="$OPTARG" ;;
Expand All @@ -79,11 +82,12 @@ while getopts a:c:e:f:i:t:ph o; do
i) openshift_install="$OPTARG" ;;
t) tests_dir="$OPTARG" ;;
p) persist='YES' ;;
r) run="$OPTARG" ;;
h) print_help; exit 0 ;;
*) print_help; exit 1 ;;
esac
done
readonly api_fip os_cloud external_network compute_flavor openshift_install tests_dir persist
readonly api_fip os_cloud external_network compute_flavor openshift_install tests_dir persist run

declare -a temp_dirs
cleanup() {
Expand All @@ -101,9 +105,10 @@ validate_configuration

declare result='PASS'
for testcase in "${tests_dir}"/* ; do
if [ -d "$testcase" ]; then
if [ -d "$testcase" ] && [[ "$testcase" =~ $run ]]; then
echo
echo "*** TEST CASE: $(basename "${testcase}")"
((test_counter+=1))
assets_dir="$(mktemp -d)"
temp_dirs+=("$assets_dir")
fill_install_config "${testcase}/install-config.yaml" > "${assets_dir}/install-config.yaml"
Expand All @@ -119,6 +124,7 @@ for testcase in "${tests_dir}"/* ; do
fi
done

echo "Ran ${test_counter} test cases."
if [ "$result" != 'PASS' ]; then
echo "FAIL"
exit 1
Expand Down