Gitility.ObjectStore.Conformance (Gitility v0.5.1)

Copy Markdown View Source

Reusable ExUnit conformance case for Gitility.ObjectStore adapters.

The using module supplies store_init_arg/0; it is invoked for every test. Shared services can be managed with optional store_setup/0 and store_teardown/1 hooks. The setup hook's return value is passed unchanged to teardown.

Deadline rows also need a deterministic blocking store. Local needs no extra hook because the kit installs its test hook in the returned state. Other adapters supply slow_store_init_arg/0; for S3 this is normally a local HTTP endpoint that drips one byte per second and never redirects.

defmodule MyApp.ObjectStoreConformanceTest do
  use Gitility.ObjectStore.Conformance, store: MyApp.ObjectStore

  def store_init_arg, do: [bucket: "test", prefix: unique_prefix()]
  def slow_store_init_arg, do: MyApp.SlowHTTPStore.init_arg()
end

The generated cases are serial because the 64 MiB streaming row samples VM-wide memory.