Codex Test Idempotent Elixir Background Jobs with Oban
Define job arguments, return values, and retry tests for an Elixir worker with repeatable database effects.
中文Install in Codex
Use an Elixir project with Oban configured, a test database, and the project's matching test module.
- Copy the pinned `skills/elixir-phoenix-oban/` directory into `.agents/skills/elixir-phoenix-oban/` in the project.
- Check whether the project uses standard Oban or Pro, then read the pinned worker and testing references.
Example task
Pass `item_id=3` to a local `CatalogIndexWorker`. Run it twice in a fixture with `Oban.Testing` and count the resulting index rows in the test database.What to check
The two runs process the same item, leave one index result, and enqueue only the required identifier.
Original SKILL.md on GitHub · Updated
Frequently asked question
Is Oban uniqueness enough for retries?
Unique enqueueing can reduce duplicate jobs. The worker also needs idempotent behavior when an existing job is retried.