Forgejo end-to-end tests
Go to file
earl-warren cff067a118
/ packages (map[branch:next forgejo:https://codeberg.org repo:forgejo-experimental/forgejo tests:${{ vars.V7_0_TESTS }} version:v7.0]) (push) Successful in 3m56s Details
/ packages (map[forgejo:https://codeberg.org repo:forgejo/forgejo tests:${{ vars.V1_21_TESTS }} version:v1.21]) (push) Successful in 3m42s Details
upgrade / upgrade (push) Successful in 10m54s Details
/ actions (map[branch:next forgejo:https://codeberg.org repo:forgejo-experimental/forgejo tests:${{ vars.V7_0_TESTS }} version:v7.0]) (push) Successful in 11m7s Details
/ actions (map[forgejo:https://codeberg.org repo:forgejo/forgejo tests:${{ vars.V1_20_TESTS }} version:v1.20]) (push) Successful in 6m28s Details
/ actions (map[forgejo:https://codeberg.org repo:forgejo/forgejo tests:${{ vars.V1_21_TESTS }} version:v1.21]) (push) Successful in 9m8s Details
Merge pull request 'Forgejo v1.22 will actually be Forgejo v7.0' (#91) from earl-warren/end-to-end:wip-alpine into main
Reviewed-on: #91
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-02-28 17:07:43 +00:00
.forgejo Merge pull request 'Forgejo v1.22 will actually be Forgejo v7.0' (#91) from earl-warren/end-to-end:wip-alpine into main 2024-02-28 17:07:43 +00:00
actions Forgejo v1.22 will actually be Forgejo v7.0 2024-02-28 17:38:31 +01:00
forgejo Forgejo v1.22 will actually be Forgejo v7.0 2024-02-28 17:38:31 +01:00
lib packages: add alpine test cases 2024-02-03 19:14:03 +01:00
packages Forgejo v1.22 will actually be Forgejo v7.0 2024-02-28 17:38:31 +01:00
.gitignore ignore setup-forgejo files 2023-11-08 15:54:46 +01:00
LICENSE import from forgejo 2023-10-26 21:21:20 +02:00
README.md Forgejo v1.22 will actually be Forgejo v7.0 2024-02-28 17:38:31 +01:00

README.md

Forgejo end-to-end tests

A series of tests scenarios and assertions covering Forgejo and the Forgejo runner. They partially rely on Forgejo actions developped specifically for testing such as setup-forgejo.

They are designed to run using Forgejo releases and development versions compiled from designated repositories.

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.80.4.76:3000" ]
}

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 actions/run.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
export DIR=/tmp/end-to-end
rm -fr /tmp/end-to-end ; sudo rm -fr /srv/example ; sudo mkdir /srv/example ; sudo chown -R $USER /srv/example

Run using Forgejo built from source.

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.

Run one example

actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 cron # runs actions/example-cron

Cleanup. It will teardown Forgejo & the runner and not run them because there is nothing to test.

actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 none

Run all examples for v7_0

actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0

Run from sources

make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo $DIR/forgejo

Remote testing

To reduce the runtime the following variables can be set to control the number of cases run by the actions 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.

  • v7_0_TESTS
  • V1_21_TESTS
  • V1_20_TESTS

Running packages locally

To run and debug package tests, from the root of the source directory.

Run one test

packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 alpine # runs packages/alpine.sh

Cleanup. It will teardown Forgejo and not run them because there is nothing to test.

packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 none

Run all examples for v7_0

packages/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0

Remote testing

To reduce the runtime the following variables can be set to control the number of cases run by the packages test 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.

  • v7_0_PACKAGES_TESTS
  • V1_21_PACKAGES_TESTS