Gitility.ODB.Backend.Conformance (Gitility v0.2.0)

Copy Markdown View Source

Reusable ExUnit conformance case for Gitility.ODB.Backend implementations.

The using module supplies a backend, its init argument, and a backend_objects/0 fixture returning at least two objects that the backend serves. The generated tests cover complete batch maps, miss/error distinction, concurrent callback safety, header fallback equivalence, optional prefetch tolerance, and verified provider round trips.

defmodule MyApp.PostgresObjectsConformanceTest do
  use Gitility.ODB.Backend.Conformance,
    backend: MyApp.PostgresObjects,
    init_arg: :test_repository,
    concurrency: 4

  def backend_objects do
    MyApp.ObjectFixtures.objects()
  end
end

backend_objects/0 must return Gitility.Object structs with populated OIDs. Conformance tests are intentionally not async because they start a provider supervision tree and exercise native round trips.