tests: support example workflows expected to fail

This commit is contained in:
Earl Warren 2023-09-02 16:21:10 +02:00
parent bc4139d0b1
commit 0d8bc04d72
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -3,11 +3,18 @@ on: [ push, pull_request ]
env: env:
# #
# List of tests to run as found in testdata/example-$test. The # List of tests to run as found in testdata/example-$test. The
# directory will be used to create a git repository, uploaded to a # directory will be used to create a git repository uploaded to a
# Forgejo instance. The test will be a success once the status of # Forgejo instance.
#
# The test will be a success once the status of
# the commit is success, as set by the Forgejo Action run. # the commit is success, as set by the Forgejo Action run.
# #
TESTS: 'echo service container expression local-action docker-action' TESTS: 'echo service container expression local-action docker-action if'
#
# The test is expected to fail the workflow and verify the expected
# side effect of the failure with testdata/example-$test/expected-to-fail.sh
#
TESTS_FAILING: 'if-fail'
jobs: jobs:
integration: integration:
@ -28,7 +35,8 @@ jobs:
# #
./forgejo-runner.sh setup ./forgejo-runner.sh setup
export FORGEJO_RUNNER_LOGS=forgejo-runner.log export FORGEJO_RUNNER_LOGS=forgejo-runner.log
for example in $TESTS ; do
for example in $TESTS $TESTS_FAILING ; do
if test $example = service ; then if test $example = service ; then
> /srv/example-service-volume-valid > /srv/example-service-volume-valid
@ -41,7 +49,13 @@ jobs:
fi fi
echo "============================ BEGIN example-$example ===================" echo "============================ BEGIN example-$example ==================="
./forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) 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
! test -f testdata/example-$example/expected-to-fail.sh
else
cat /tmp/run.out
test -f testdata/example-$example/expected-to-fail.sh
fi
echo "============================ END example-$example ===================" echo "============================ END example-$example ==================="
if test -f $config ; then if test -f $config ; then