#!/usr/share/ucs-test/runner bash
## desc: run tests in container which are supplied by the kelvin api
## tags: [ucs_school_kelvin]
## exposure: dangerous
## packages: []
## bugs: []

APP="ucsschool-kelvin-rest-api"
MIN_COVERAGE=70

declare -a CMD=(sh -c "
cd /kelvin/kelvin-api &&
export MY_COVERAGE_REPORT_ARGS=\"--fail-under=$MIN_COVERAGE\" &&
rm -f .coverage &&
make coverage")

echo "Running in container:" "${CMD[@]}"

univention-app shell "$APP" "${CMD[@]}" || (rv=$?; pkill -f '^/usr/bin/python.*pytest$'; exit $rv)
