Documentation
¶
Overview ¶
Package storagetest is the conformance suite for jobsync Storage drivers. A driver is "official" when it passes Run with zero skips.
This exists because a prose contract is not a contract. The subtle parts of Storage — that Fetch is atomic across processes, that a late Finish from a server whose lease expired is ignored rather than applied, that a terminal job releases its unique key — are exactly the parts a new driver gets wrong, and exactly the parts that stay invisible until production. Each is a test here.
A driver's test file is three lines:
func TestConformance(t *testing.T) {
storagetest.Run(t, func(t *testing.T) jobsync.Storage { return newTestStore(t) })
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DSN ¶
DSN returns the connection string for a driver's tests.
Unset locally it skips, naming the command that fixes it. Unset in CI it fails: a conformance suite that silently skips is worse than no suite, because it reports green while testing nothing. CI is detected by the CI environment variable, which GitHub Actions, GitLab and most others set.
func Run ¶
Run executes the whole conformance suite against newStore. Optional capabilities the driver does not implement are skipped, not failed.
func RunAPI ¶
RunAPI exercises the dashboard's JSON API against a driver. It is separate from Run because it tests the HTTP layer rather than the Storage contract, but it runs against every driver for the same reason: the API is what the UI depends on, and a shape that differs between drivers becomes permanent the moment a page reads it.