base_tests.sh: make the test self-contained
We claim to have self-contained test cases, but the base_tests.sh script still requires the WORKSPACE environment variable to be set outside of the script, which is what Jenkins does. This patch replaces WORKSPACE with a temporary directory and modifies Jenkinsfile to use it when collecting logs.
This commit is contained in:
parent
6962c4d8e6
commit
1b4db3377b
2 changed files with 5 additions and 1 deletions
|
|
@ -3,6 +3,8 @@ set -euo pipefail
|
|||
|
||||
WORKING_DIRECTORY=/usr/libexec/osbuild-composer
|
||||
TESTS_PATH=/usr/libexec/osbuild-composer-test
|
||||
mkdir --parents /tmp/logs
|
||||
LOGS_DIRECTORY=$(mktemp --directory --tmpdir=/tmp/logs)
|
||||
|
||||
PASSED_TESTS=()
|
||||
FAILED_TESTS=()
|
||||
|
|
@ -27,7 +29,7 @@ run_test_case () {
|
|||
echo "🏃🏻 Running test: ${TEST_NAME}"
|
||||
test_divider
|
||||
|
||||
if sudo "${1}" -test.v | tee "${WORKSPACE}"/"${TEST_NAME}".log; then
|
||||
if sudo "${1}" -test.v | tee "${LOGS_DIRECTORY}"/"${TEST_NAME}".log; then
|
||||
PASSED_TESTS+=("$TEST_NAME")
|
||||
else
|
||||
FAILED_TESTS+=("$TEST_NAME")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue