2023-10-28 22:29:04 +02: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.
|
2023-10-29 17:03:25 +01:00
|
|
|
|
2024-01-24 00:03:34 +01:00
|
|
|
# Hacking
|
2023-10-29 17:03:25 +01:00
|
|
|
|
2024-01-24 00:03:34 +01: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.80.4.76:3000" ]
|
|
|
|
}
|
|
|
|
```
|
2023-11-08 15:55:01 +01:00
|
|
|
|
2024-01-24 00:03:34 +01:00
|
|
|
Use setup-forgejo from source.
|
2023-11-08 15:55:01 +01: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 16:59:50 +01:00
|
|
|
export DIR=/tmp/end-to-end
|
2024-01-18 17:44:12 +00:00
|
|
|
rm -fr /tmp/end-to-end ; sudo rm -fr /srv/example ; sudo mkdir /srv/example ; sudo chown -R $USER /srv/example
|
2023-11-08 15:55:01 +01:00
|
|
|
```
|
2023-12-20 16:59:50 +01:00
|
|
|
|
2024-01-24 00:03:34 +01:00
|
|
|
Run using Forgejo built from source.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
|
|
|
|
cp -a forgejo $DIR/forgejo
|
|
|
|
```
|
|
|
|
|
|
|
|
## 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-12-20 16:59:50 +01:00
|
|
|
Run one example
|
|
|
|
|
|
|
|
```sh
|
2024-01-13 17:57:29 +01:00
|
|
|
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 cron # runs actions/example-cron
|
2023-12-20 16:59:50 +01:00
|
|
|
```
|
|
|
|
|
2024-01-18 17:44:12 +00:00
|
|
|
Cleanup. It will teardown Forgejo & the runner and not run them because there is nothing to test.
|
2023-12-20 16:59:50 +01:00
|
|
|
|
|
|
|
```sh
|
2024-01-13 17:57:29 +01:00
|
|
|
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 none
|
2023-12-20 16:59:50 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Run all examples for v1_22
|
2023-11-08 15:55:01 +01:00
|
|
|
|
|
|
|
```sh
|
2024-01-13 17:57:29 +01:00
|
|
|
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22
|
2023-11-08 15:55:01 +01:00
|
|
|
```
|
2023-10-29 17:03:25 +01:00
|
|
|
|
2024-01-18 17:44:12 +00:00
|
|
|
Run from sources
|
|
|
|
|
|
|
|
```sh
|
|
|
|
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
|
|
|
|
cp -a forgejo $DIR/forgejo
|
|
|
|
```
|
|
|
|
|
2024-01-24 00:03:34 +01:00
|
|
|
Remote testing
|
2023-10-29 17:03:25 +01:00
|
|
|
|
|
|
|
To reduce the runtime the following variables can be set to control
|
|
|
|
the number of cases run by the
|
|
|
|
[actions](.forgejo/workflows/actions.yml) tests. If set to
|
|
|
|
**none** they are not run at all for that version of Forgejo. If
|
|
|
|
it does not exist, all tests are run.
|
|
|
|
|
2023-12-20 16:59:50 +01:00
|
|
|
* `V1_22_TESTS`
|
2023-10-29 17:03:25 +01:00
|
|
|
* `V1_21_TESTS`
|
|
|
|
* `V1_20_TESTS`
|
2024-01-24 00:03:34 +01:00
|
|
|
|
|
|
|
## Running packages locally
|
|
|
|
|
|
|
|
To run and debug package tests, from the root of the source directory.
|
|
|
|
|
|
|
|
Run one test
|
|
|
|
|
|
|
|
```sh
|
|
|
|
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 alpine # runs packages/alpine.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Cleanup. It will teardown Forgejo and not run them because there is nothing to test.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 none
|
|
|
|
```
|
|
|
|
Run all examples for v1_22
|
|
|
|
|
|
|
|
```sh
|
|
|
|
packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22
|
|
|
|
```
|
|
|
|
|
|
|
|
Remote testing
|
|
|
|
|
|
|
|
To reduce the runtime the following variables can be set to control
|
|
|
|
the number of cases run by the
|
|
|
|
[packages test](.forgejo/workflows/packages.yml) tests. If set to
|
|
|
|
**none** they are not run at all for that version of Forgejo. If
|
|
|
|
it does not exist, all tests are run.
|
|
|
|
|
|
|
|
* `V1_22_PACKAGES_TESTS`
|
|
|
|
* `V1_21_PACKAGES_TESTS`
|