Allow local testing
- Move integration testing to run locally
And not in Docker. This patch is to prove things work, so I've just
moved one test across (though most of the changes are in test setup that
can be re-used across tests). If this gets tractions, more tests could
be moved across. Reasons for this approach:
* Simplicity: tests have no external requirements besides `git`
* Debugability: running locally you can spin up a debugger (or just
sleep in tests) and inspect the running environment. This is possible
with Docker, but more of a hassle
* Reproducibility: tests are decoupled from the user's environment, so
failures should be reproducible
This is achieved via:
* Using git's worktree's[1] to run things like `git commit` without
modifying the working repo
* Having the tests build a strongbox binary that we can then configure
`git` with (built once per run)
* Adding some test setup with actual keys etc. rather than relying on the
user having keys define
For posterity, the commands to setup the keys etc
go run . -identity-file ./testdata/.strongbox_identity -gen-identity test-key
grep --only-matching --perl-regexp '(?<=# public key: ).*' ./testdata/.strongbox_identity > ./testdata/.strongbox_recipient
Link: https://git-scm.com/docs/git-worktree [1]
- Add run of local tests in GitHub
合并状态:已合并 合并于 2025-01-28 关闭于 2025-01-28 8 条评论