1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-forgejo synced 2024-09-19 01:46:16 +00:00

better verbosity for integration tests

This commit is contained in:
Earl Warren 2023-10-04 18:11:42 +02:00
parent eaecaaa2e6
commit 65714b4555
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 27 additions and 20 deletions

View file

@ -16,8 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- if: matrix.info.tests != 'none'
shell: bash
run: |
set -x
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
export PATH=$(pwd):$PATH
forgejo.sh setup root admin1234 ${{ matrix.info.image }} ${{ matrix.info.version }}
@ -32,29 +32,41 @@ jobs:
forgejo-runner.sh setup
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
for example in ${{ matrix.info.tests }} ; do
echo "============================ demo ==================="
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
grep '^sha=' /tmp/output
function run() {
local example=$1
export example
export EXAMPLE_DIR=$(pwd)/testdata/example-$example
if test -f $EXAMPLE_DIR/setup.sh ; then
$EXAMPLE_DIR/setup.sh
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
echo "============================ BEGIN example-$example ==================="
if test -f $EXAMPLE_DIR/run.sh ; then
$EXAMPLE_DIR/run.sh
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
if ! forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) >& /tmp/run.out ; then
cat /tmp/run.out
false
fi
forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) || return 1
fi
echo "============================ END example-$example ==================="
if test -f $EXAMPLE_DIR/teardown.sh ; then
$EXAMPLE_DIR/teardown.sh
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
fi
}
for example in ${{ matrix.info.tests }} ; do
echo "============================ BEGIN example-$example ==================="
if ! time run $example >& /tmp/run.out ; then
cat /tmp/run.out
echo "============================ FAIL example-$example ==================="
sleep 5 # hack for Forgejo v1.21 to workaround a but by which the last lines of the output are moved to the next step
false
fi
echo "============================ END example-$example ==================="
done
echo "============================ demo ==================="
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
grep '^sha=' /tmp/output

View file

@ -1,7 +1,4 @@
if forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) >& /tmp/run.out ; then
cat /tmp/run.out
false
fi
! forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token)
grep --quiet 'IF TEST FAILURE' $FORGEJO_RUNNER_LOGS
grep --quiet 'IF TEST ALWAYS' $FORGEJO_RUNNER_LOGS

View file

@ -1,5 +1,3 @@
set -e
url=http://root:admin1234@$(cat forgejo-ip):3000
api=$url/api/v1
export d=/srv/example-pull-request