Commit 94cf24e
authored
Make the test fixture local and auditable (#241)
* Replace the network fixture clone with a local git bundle
The test suite cloned https://github.com/gitonomy/foobar.git over the
network on every run, and asserted on hardcoded commit SHAs from that
external repository's history. This made the tests fail without
network access, coupled them to a repository outside our control, and
made it impossible for a contributor to add a new fixture scenario
without push access to that separate repository.
tests/fixtures/foobar.bundle is a git bundle of the same repository
(all branches and tags, including the GPG-signed commit used by
PushReferenceTest). Admin::cloneTo/cloneBranchTo/cloneRepository just
shell out to `git clone <url> <path>`, so cloning from a local bundle
file behaves identically to cloning the remote repository, but works
offline and can't be affected by changes made upstream.
* Guard the fixture bundle against unreviewable changes in CI
Since tests/fixtures/foobar.bundle is a binary file, GitHub shows a PR
touching it as an opaque "binary file not shown" diff: a contributor
could regenerate it with extra refs or bloated content while keeping
the commit SHAs the tests rely on intact, and a reviewer would have no
way to see it from the diff alone.
tests/fixtures/verify-bundle.sh runs `git bundle verify`, checks the
ref list against an explicit allow-list of the 5 branches and 2 tags
the fixture actually needs, and fails if the file grows past 200KB
(current size: ~39KB). Any legitimate change to the fixture's shape or
size requires editing this script in the same PR, making the change
explicit and reviewable instead of silent. Wired into CI as a new
verify-fixture job that runs on every push and pull request.
* Document the test fixture bundle in CONTRIBUTING.md
Explains what tests/fixtures/foobar.bundle is, how to regenerate it to
add a new fixture scenario, and why tests/fixtures/verify-bundle.sh
exists and needs updating alongside any intentional change to the
bundle's refs or size.
* Make the fixture regeneration recipe fully local
The docs and comments still pointed at cloning gitonomy/foobar over
the network to add a new fixture scenario, defeating the point of
moving to a local bundle. The bundle already contains the full history
(all branches and tags), so regenerating it only ever needs to clone
tests/fixtures/foobar.bundle itself — verified this reproduces a
byte-identical bundle with no network access.1 parent b8ed9c0 commit 94cf24e
6 files changed
Lines changed: 98 additions & 1 deletion
File tree
- .github
- workflows
- tests
- Gitonomy/Git/Tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
42 | 71 | | |
43 | 72 | | |
44 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments