58 lines
2.1 KiB
Markdown
58 lines
2.1 KiB
Markdown
# 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.
|
|
|
|
## Hacking
|
|
|
|
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.
|
|
|
|
### Prepare the Forgejo instance and the runner
|
|
|
|
```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
|
|
forgejo-curl.sh logout
|
|
forgejo-runner.sh teardown
|
|
forgejo.sh teardown
|
|
forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.21
|
|
forgejo-runner.sh setup
|
|
export url=http://root:admin1234@$(cat forgejo-ip):3000
|
|
export token=$(cat forgejo-token)
|
|
```
|
|
### Run a single test
|
|
|
|
```sh
|
|
export example=pull-request
|
|
export EXAMPLE_DIR=$(pwd)/actions/example-$example
|
|
sudo rm -fr /srv/example-$example ; mkdir /srv/example-$example
|
|
$EXAMPLE_DIR/setup.sh
|
|
$EXAMPLE_DIR/run.sh
|
|
forgejo-test-helper.sh run_workflow actions/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token)
|
|
```
|
|
|
|
### Remote testing
|
|
|
|
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.
|
|
|
|
* `V1_21_TESTS`
|
|
* `V1_20_TESTS`
|