1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-06 12:45:57 +01:00
Files
atomic/tests/integration/setup-scripts/system_containers_setup.sh
Giuseppe Scrivano 6ce51fd4ec tests: skip system containers test if skopeo copy to ostree fails
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1244
Approved by: rhatdan
2018-06-27 13:19:55 +00:00

58 lines
1.2 KiB
Bash
Executable File

assert_not_reached() {
echo $@ 1>&2
exit 1
}
assert_not_matches() {
if grep -q -e $@; then
sed -e s',^,| ,' < $2
assert_not_reached "Matched: " $@
fi
}
assert_matches() {
if ! grep -q -e $@; then
sed -e s',^,| ,' < $2
assert_not_reached "Failed to match: " $@
fi
}
assert_equal() {
if ! test $1 = $2; then
assert_not_reached "Failed: not equal " $1 $2
fi
}
# Skip the test if:
# 1. OSTree or runc are not installed
# 2. the version of runc is too low
# 3. atomic has not --install --system
# 4. skopeo copy to ostree fails
ostree --version &>/dev/null || exit 77
runc --version &>/dev/null || exit 77
if runc --version | grep -q "version 0"; then
exit 77
fi
${ATOMIC} install --help 2>&1 > help.out
grep -q -- --system help.out || exit 77
export PYTHON=${PYTHON:-/usr/bin/python}
export ATOMIC_OSTREE_REPO=${WORK_DIR}/repo
export ATOMIC_OSTREE_CHECKOUT_PATH=${WORK_DIR}/checkout
export NAME="test-system-container-$$"
ostree --repo=$ATOMIC_OSTREE_REPO init
if test -n "$SKOPEO_NO_OSTREE"; then
exit 77
fi
# This is to prevent the case where the ostree checkout path
# can be non-existent when no container installation happens prior
mkdir -p $ATOMIC_OSTREE_CHECKOUT_PATH