The readme highlights things which could be targets for improvement in the future (e.g. lack of isolation from the environment) but for now the explanation should probably be sufficient.
68 lines
2.3 KiB
Org Mode
68 lines
2.3 KiB
Org Mode
* Forgejo integration testing
|
|
|
|
This repository contains a small selection of tests for validating
|
|
interactions of git-annex with a Forgejo-aneksajo instance.
|
|
|
|
** Example usage
|
|
|
|
Using =uv run pytest= from the project root is recommended to
|
|
automatically manage dependencies. The following command will run all
|
|
tests against the given forgejo instance, creating repositories under
|
|
the "scratch" organization (which must exist beforehand):
|
|
|
|
#+begin_src
|
|
export FORGEJO_TOKEN=<...>
|
|
uv run pytest --instance-url https://hub.example.invalid --org scratch --gpg-keyid B2682F34
|
|
#+end_src
|
|
|
|
Not all parameters are mandatory, see below.
|
|
|
|
** Parametrization
|
|
|
|
*** CLI
|
|
|
|
The following parameters can be provided to pytest:
|
|
|
|
- =--instance-url= (required): base URL of the forgejo instance that
|
|
the tests will run against
|
|
- =--org=: name of the organization for creating test repositories; if
|
|
not provided, all repositories will be created under the user
|
|
account the token belongs to
|
|
- =--gpg-keyid=: GPG key ID for use with tests that use encrypted
|
|
special remotes (used with initremote); these tests will be skipped
|
|
if not provided
|
|
|
|
*** Environment variables
|
|
|
|
The following environment variables will be read on setup:
|
|
|
|
- =FORGEJO_TOKEN=: access token to use for forgejo API calls
|
|
(e.g. creating repositories); needs read:misc, write:organization,
|
|
write:repository, and write:user permissions
|
|
|
|
** Environment and interactions
|
|
|
|
Forgejo API calls will be done using the instance URL and credentials
|
|
provided.
|
|
|
|
Git & git-annex operations will be done in the same environment as the
|
|
pytest process, ie. with the configuration and credential helpers
|
|
defined by the user. Caching or unlocked store of git credentials will
|
|
eliminate the need for interaction.
|
|
|
|
GPG operations (done by git-annex) will be done in the same
|
|
environment as the pytest process, ie. with the user's key
|
|
store. These tests are enabled by providing the =--gpg-keyid= option
|
|
and skipped otherwise. A dedicated throwaway key with no password
|
|
would work best.
|
|
|
|
** Repository organization
|
|
|
|
Tests are in =tests=, helpers are in =src= to make them importable as
|
|
a named package (although they are likely not very useful on their
|
|
own).
|
|
|
|
** Caveats
|
|
|
|
Repository cleanup is not yet implemented, so test repositories are
|
|
(currently) not removed after the test session.
|