BrighterCommand / BrighterCommand/Brighter
Test Generator: `CollectionName` is ignored by Sync outbox templates, so sync tests are never serialised
- Dominant language
- C#
- Stars
- 2.5k
- Forks
- 296
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Summary
`OutboxConfiguration.CollectionName` is intended to render an xUnit `[Collection(...)]` attribute so tests sharing infrastructure do not run concurrently. It is honoured by the **Async** outbox templates but **not by any of the Sync** ones, so the generated sync outbox tests carry no `[Collection]` and can run in parallel against the same store.
## Evidence
From `tools/Paramore.Brighter.Test.Generator/Templates`:
```
$ grep -rl "CollectionName" Templates/Outbox/Async/ | wc -l
12
$ grep -rl "CollectionName" Templates/Outbox/Sync/ | wc -l
0
```
The messaging gateway templates (`Reactor/` and `Proactor/`) both honour it, so the outbox `Sync` set is the odd one out.
Configs that set `CollectionName` on an outbox and are silently getting no serialisation on their sync tests include `tests/Paramore.Brighter.MySQL.Tests/test-configuration.json` (`MySQLTextOutbox`, `MySQLBinaryOutbox`) and the MSSQL/PostgreSQL equivalents.
## Impact
A likely source of CI flakiness: two sync outbox test classes over the same store can interleave. It would also be masked today wherever the outbox is configured with the singular `Outbox` form, since no sync tests are generated at all (see the sibling issue on that).
## Expected
The `Sync` outbox templates should emit `[Collection(...)]` the same way the `Async` ones do:
```liquid
{% if CollectionName != null %}[Collection("{{CollectionName}}")]{% endif %}
```
## Suggested fix
Add the conditional to the 12 templates in `Templates/Outbox/Sync/`, then regenerate all projects with `./generate-test.sh`.
## Notes
Found while documenting the generator for `docs/factories/tests`, where the gap is currently noted as a known defect.
Contributor guide
Assessment
This issue has not been assessed yet.