rpm-ostree/tests/compose
Jonathan Lebon 45e162fb69 ci: Split compose test into two
The `f28-compose` test keeps timing out. Some time recently, I/O
performance of the internal OpenStack instance used for testing has
degraded. I have a ticket open to investigate the regression though
haven't had any luck so far.

Let's just take the easy way out and split the test into two testsuites.
This is obviously hacky, and sad, and unfortunate. But the PRs must keep
flowing until we finally wean off of OpenStack.

Closes: #1498
Approved by: cgwalters
2018-08-13 21:06:18 +00:00

94 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
dn=$(cd $(dirname $0) && pwd)
export topsrcdir=$(cd $dn/.. && pwd)
. ${dn}/common/libtest-core.sh
. ${dn}/common/libcomposetest.sh
# avoid refetching yum metadata everytime
export RPMOSTREE_USE_CACHED_METADATA=1
export LOGDIR=${LOGDIR:-$(pwd)/test-compose-logs}
mkdir -p ${LOGDIR}
colour_print() {
colour=$1; shift
[ ! -t 1 ] || echo -en "\e[${colour}m"
echo -n "$@"
[ ! -t 1 ] || echo -en "\e[0m"
echo
}
pass_print() {
colour_print 32 "$@" # green
}
fail_print() {
colour_print 31 "$@" # red
}
skip_print() {
colour_print 34 "$@" # blue
}
uid=$(id -u)
test_compose_datadir=/var/tmp/rpmostree-compose-cache-${uid}
export test_compose_datadir
mkdir -p ${test_compose_datadir}
datadir_owner=$(stat -c '%u' ${test_compose_datadir})
test ${uid} = ${datadir_owner}
# Create a consistent cache of the RPMs
echo "Preparing compose tests... $(date)"
tmp_repo=${test_compose_datadir}/tmp-repo
if test -z "${RPMOSTREE_COMPOSE_CACHEONLY:-}"; then
mkdir -p ${test_compose_datadir}/cache
setup_rpmmd_repos ${dn}/composedata
ostree --repo=${tmp_repo} init --mode=bare-user
# We use rpm-ostree in dry-run --cachedir mode
rpm-ostree compose --repo=${tmp_repo} tree --download-only --cachedir=${test_compose_datadir}/cache ${dn}/composedata/fedora-base.json
(cd ${test_compose_datadir}/cache && createrepo_c .)
fi
echo "Done preparing compose tests! $(date)"
rm ${tmp_repo} -rf
total=0
pass=0
fail=0
skip=0
all_tests="$(cd ${dn}/compose-tests && ls test-*.sh | sort)"
if [ "${RPMOSTREE_COMPOSE_TEST_FILTER:-}" == odd ]; then
# https://superuser.com/a/101760/237392
all_tests="$(sed -n 'p;n' <<< ${all_tests})"
elif [ "${RPMOSTREE_COMPOSE_TEST_FILTER:-}" == even ]; then
all_tests="$(sed -n 'n;p' <<< ${all_tests})"
fi
tests=""
if [ -n "${TESTS+ }" ]; then
for tf in ${all_tests}; do
tfbn=$(basename "$tf" .sh)
tfbn=" ${tfbn#test-} "
if [[ " $TESTS " != *$tfbn* ]]; then
echo "Skipping: ${tf}"
continue
fi
tests="${tests} ${tf}"
done
else
tests="${all_tests}"
fi
if test -z "${tests}"; then
fatal "error: No tests match ${TESTS}"
fi
echo "Compose tests starting: $(date)"
echo "Executing: ${tests}"
echo "Writing logs to ${LOGDIR}"
(for tf in ${tests}; do echo $tf; done) | \
parallel -v -j +1 --progress --halt soon,fail=1 \
--results ${LOGDIR}/parallel --quote /bin/sh -c "${dn}/compose-tests/run-test.sh {}"
echo "$(date): All tests passed"