Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/295 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> |
||
---|---|---|
.forgejo | ||
actions | ||
federation | ||
forgejo | ||
lib | ||
packages | ||
storage | ||
upgrade | ||
.editorconfig | ||
.gitignore | ||
end-to-end.sh | ||
LICENSE | ||
README.md |
Forgejo end-to-end tests
A series of tests scenarios and assertions covering Forgejo and the Forgejo runner.
They are designed to run using Forgejo releases and development versions compiled from designated repositories.
Removing legacy tests
End-to-end tests cover the supported range of releases and when one of them is EOL, it must be removed as well as the tests that target it specifically. Otherwise the test suite would grow indefinitely.
When a release is EOL, a branch is cut with a name following the
pattern legacy/vX.Y-vA.B
. For instance when v8.0
is published and
v1.21
is EOL, the branch legacy/v8.0-v1.21
is cut.
Hacking
docker and sudo must be installed with insecure registries allowed in /etc/docker/daemon.json for the IP that will be used for forgejo such as:
{
"insecure-registries": [ "10.0.0.0/8" ]
}
Use setup-forgejo from source.
The setup-forgejo
repository is a Forgejo
Action which is meant
to be used in workflows. However, it is implemented as shell scripts that
can also be used to create Forgejo instances and runners locally. This
is convenient for testing and the reason why it needs to be added to the PATH.
For instance, it is a dependency of the end-to-end.sh
script.
git clone https://code.forgejo.org/actions/setup-forgejo
export PATH=$(pwd)/setup-forgejo:$PATH
git clone https://code.forgejo.org/forgejo/end-to-end
cd end-to-end
Running from locally built binary
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo /srv/forgejo-binaries/forgejo-10.0
It will be used whenever the version 10.0
is specified in a test.
Running actions locally
To run and debug workflows from actions/example-*
, from the root of
the source directory, with docker and forgejo-curl.sh installed, mimic
what .forgejo/workflows/end-to-end.yml
does. There may be some manual
tweaking (such as creating temporary directories) because the tests
run as root in the context of Forgejo Actions and assume they have
admin permissions. But they do not need to run as root and must work
fine when run as a regular user.
./end-to-end.sh run dependencies
./end-to-end.sh actions_setup 10.0
firefox 0.0.0.0:3000 # user root / admin1234
./end-to-end.sh actions_verify_example echo
./end-to-end.sh actions_teardown
Running other tests locally
To run and debug tests, from the root of the source directory.
Run one test. When the test fails the instance can be inspected at http://0.0.0.0:3000
./end-to-end.sh test_packages_alpine
./end-to-end.sh test_storage_stable_s3 minio
Cleanup. It will teardown the Forgejo instance.
./end-to-end.sh stop