debian-forge-composer/test/cases/manifest_tests.sh
Jakub Rusz efbd5ebd7b ci/tests: Change the way artifacts are collected
We want to be able to safely gather any artifacts without worrying about
any possible secrets leaking. Every artifacts that we want to upload
will now have to be placed in /tmp/artifacts which will then be uploaded
to S3 by the executor and link to the artifacts will be provided in the
logs. Only people with access to our AWS account can see them.
2022-07-18 11:33:57 +03:00

35 lines
994 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
MANIFEST_TESTS_RUNNER="/usr/libexec/osbuild-composer-test/osbuild-composer-manifest-tests"
DNF_JSON_PATH="/usr/libexec/osbuild-composer/dnf-json"
IMAGE_TEST_CASES_PATH="/usr/share/tests/osbuild-composer/manifests"
WORKING_DIRECTORY=/usr/libexec/osbuild-composer
ARTIFACTS="${ARTIFACTS:-/tmp/artifacts}"
# Print out a nice test divider so we know when tests stop and start.
test_divider () {
printf "%0.s-" {1..78} && echo
}
# Provision the software under test.
/usr/libexec/osbuild-composer-test/provision.sh
# Change to the working directory.
cd $WORKING_DIRECTORY
# Run test case.
TEST_NAME=$(basename "$MANIFEST_TESTS_RUNNER")
echo
test_divider
echo "🏃🏻 Running test: ${TEST_NAME}"
test_divider
if sudo "$MANIFEST_TESTS_RUNNER" -test.v -manifests-path "$IMAGE_TEST_CASES_PATH" -dnf-json-path "$DNF_JSON_PATH" | tee "${ARTIFACTS}"/"${TEST_NAME}".log; then
echo "🎉 Test passed."
exit 0
else
echo "🔥 Test failed."
exit 1
fi