Skip to content

Commit f81563b

Browse files
committed
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.
1 parent 51f0f75 commit f81563b

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎.github/CONTRIBUTING.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,34 @@ $ vendor/bin/phpunit
3939

4040
* A script `test-git-versions.sh` is available in repository to test gitlib against many git versions.
4141
* The tests will be automatically run by [GitHub Actions](https://github.com/features/actions) against pull requests.
42+
* Tests run fully offline: no network access is required.
43+
44+
## Test fixtures
45+
46+
Most tests run against a fixture repository cloned from `tests/fixtures/foobar.bundle`,
47+
a git bundle of [gitonomy/foobar](https://github.com/gitonomy/foobar). Using a local
48+
bundle instead of cloning the repository over the network keeps the tests fast, offline,
49+
and independent of that repository's history.
50+
51+
If you need a new fixture scenario (a specific merge, encoding, or signed-commit shape,
52+
for example), regenerate the bundle from a clone of `gitonomy/foobar` with your changes
53+
added, using the same set of refs already in the bundle:
54+
55+
```bash
56+
$ git clone https://github.com/gitonomy/foobar.git /tmp/foobar && cd /tmp/foobar
57+
# ... add your commits, branches or tags ...
58+
$ git bundle create foobar.bundle \
59+
HEAD refs/heads/master refs/heads/new-feature refs/heads/diff-features \
60+
refs/heads/pagination refs/heads/path-resolving refs/tags/0.1 refs/tags/annotated
61+
$ cp foobar.bundle /path/to/gitlib/tests/fixtures/foobar.bundle
62+
```
63+
64+
Then update the commit SHA constants in `AbstractTestCase` to match, and run
65+
`tests/fixtures/verify-bundle.sh`. It checks the bundle's integrity, its ref list against
66+
an allow-list, and its size, since GitHub renders any change to this binary file as an
67+
opaque diff. If your change intentionally adds a ref or grows the file, update
68+
`ALLOWED_REFS` or `MAX_SIZE_KB` in that script as part of the same pull request, so the
69+
reason for the change is explicit and reviewable rather than a silent binary diff.
4270

4371
## Standard code
4472

0 commit comments

Comments
 (0)