end-to-end/README.md

83 lines
2.5 KiB
Markdown
Raw Normal View History

2023-10-28 20:29:04 +00:00
# Forgejo end-to-end tests
A series of tests scenarios and assertions covering
[Forgejo](https://codeberg.org/forgejo/forgejo) and the [Forgejo
runner](https://code.forgejo.org/forgejo/runner). They partially rely
on [Forgejo actions](https://code.forgejo.org/actions) developped
specifically for testing such as
[setup-forgejo](https://code.forgejo.org/actions/setup-forgejo).
They are designed to run using Forgejo releases and development
versions compiled from designated repositories.
2024-01-23 23:03:34 +00:00
# Hacking
2024-01-23 23:03:34 +00:00
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:
```json
{
"insecure-registries": [ "10.0.0.0/8" ]
2024-01-23 23:03:34 +00:00
}
```
2023-11-08 14:55:01 +00:00
2024-01-23 23:03:34 +00:00
Use setup-forgejo from source.
2023-11-08 14:55:01 +00:00
The [setup-forgejo](https://code.forgejo.org/actions/setup-forgejo)
repository is a [Forgejo
Action](https://forgejo.org/docs/v1.21/user/actions/) 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.
2023-11-08 14:55:01 +00:00
```sh
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
```
2023-12-20 15:59:50 +00:00
## Running from locally built binary
2024-01-23 23:03:34 +00:00
```sh
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo /srv/forgejo-binaries/forgejo-7.0-dev
2024-01-23 23:03:34 +00:00
```
It will be used whenver the version `7.0-dev` is specified in a test.
2024-01-23 23:03:34 +00:00
## 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/actions.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.
2023-11-08 14:55:01 +00:00
```sh
./end-to-end.sh actions_setup 1.21
firefox 0.0.0.0:3000 # user root / admin1234
./end-to-end.sh actions_verify_example artifacts
./end-to-end.sh actions_teardown
2023-11-08 14:55:01 +00:00
```
## Running other tests locally
2024-01-23 23:03:34 +00:00
To run and debug tests, from the root of the source directory.
2024-01-23 23:03:34 +00:00
Run one test. When the test fails the instance can be inspected at http://0.0.0.0:3000
2024-01-23 23:03:34 +00:00
```sh
./end-to-end.sh test_packages_alpine
./end-to-end.sh test_storage_stable_s3 minio
2024-01-23 23:03:34 +00:00
```
Cleanup. It will teardown the Forgejo instance.
2024-01-23 23:03:34 +00:00
```sh
./end-to-end.sh stop
2024-01-23 23:03:34 +00:00
```