No description
Find a file
Earl Warren 9f55d67bd2
actions: push-cancel intermitent failure
A) When both push happen within the same second, the SHA will be
  identical and there will not be any cancelation.
B) When `sleep infinity` happens after the reload of the runner, it
   will block the following tests forever because it has a capacity of one.

Fixes: https://code.forgejo.org/forgejo/end-to-end/issues/144

2024-05-13T00:58:49.1453499Z actions_verify_example.out:[main (root-commit) cbf3afb] initial commit
2024-05-13T00:58:49.1453528Z actions_verify_example.out: 3 files changed, 28 insertions(+)
2024-05-13T00:58:49.1453556Z actions_verify_example.out: create mode 100644 .forgejo/workflows/test.yml
2024-05-13T00:58:49.1453585Z actions_verify_example.out: create mode 100755 run.sh
2024-05-13T00:58:49.1453611Z actions_verify_example.out: create mode 100644 teardown.sh
2024-05-13T00:58:49.1453638Z actions_verify_example.out:+ git remote add origin http://root:admin1234@10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1453669Z actions_verify_example.out:+ git push --force -u origin main
2024-05-13T00:58:49.1453699Z actions_verify_example.out:remote: . Processing 1 references
2024-05-13T00:58:49.1453728Z actions_verify_example.out:remote: Processed 1 references in total
2024-05-13T00:58:49.1453758Z actions_verify_example.out:To http://10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1453786Z actions_verify_example.out: * [new branch]      main -> main
2024-05-13T00:58:49.1453814Z actions_verify_example.out:branch 'main' set up to track 'origin/main'.
...
2024-05-13T00:58:49.1458629Z actions_verify_example.out:[main (root-commit) cbf3afb] initial commit
2024-05-13T00:58:49.1458656Z actions_verify_example.out: 3 files changed, 28 insertions(+)
2024-05-13T00:58:49.1458683Z actions_verify_example.out: create mode 100644 .forgejo/workflows/test.yml
2024-05-13T00:58:49.1458711Z actions_verify_example.out: create mode 100755 run.sh
2024-05-13T00:58:49.1458738Z actions_verify_example.out: create mode 100644 teardown.sh
2024-05-13T00:58:49.1458764Z actions_verify_example.out:+ git remote add origin http://root:admin1234@10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1458795Z actions_verify_example.out:+ git push --force -u origin main
2024-05-13T00:58:49.1458822Z actions_verify_example.out:Everything up-to-date
2024-05-13 19:42:42 +02:00
.forgejo tests: the development branch requires go 1.22 to build 2024-03-25 18:26:07 +01:00
actions actions: push-cancel intermitent failure 2024-05-13 19:42:42 +02:00
forgejo the forgejo development branch is now 8.0 2024-03-30 14:44:43 +01:00
lib fix(lib): explicitly set the page limit for releases 2024-05-03 07:40:34 +01:00
packages Merge pull request 'merge actions test into end-to-end.sh' (#112) from twenty-panda/end-to-end:wip-actions into main 2024-03-20 13:18:28 +00:00
storage chore(cleanup): v1.20 is EOL, trim it 2024-04-25 14:24:50 +02:00
upgrade fix(pprof): reset_forgejo before running it 2024-04-25 14:24:52 +02:00
.editorconfig add editorconfig to help with Forgejo space display 2024-02-28 18:49:46 +01:00
.gitignore upgrades: remove ad-hoc code and use forgejo-curl.sh instead 2024-03-15 10:21:58 +07:00
end-to-end.sh merge actions test into end-to-end.sh 2024-03-20 13:42:44 +01:00
LICENSE import from forgejo 2023-10-26 21:21:20 +02:00
README.md docs: managing legacy tests and cutting branches 2024-04-25 13:24:51 +02:00

Forgejo end-to-end tests

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

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-7.0-dev

It will be used whenever the version 7.0-dev 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/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.

./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

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