Tests a parked timer against the real store - #136
Merged
Merged
Conversation
The parked-timer test beside this one runs against a stand-in store, because the lock resolved statifier_persistence 0.13.0, which predates the needs_migration status and unpark/3. The lock now resolves statifier_persistence 0.21.0, and a second test fires a timer into an execution parked in that package's own InMemory store, through a delivery shaped on the README's durable module that calls StatifierPersistence.Executions.step/5. Its assertions are the stand-in's: the first attempt raises on the needs_migration refusal, the job is retryable (not cancelled or discarded) and still pending for the scope; after StatifierPersistence.Executions.unpark/3 the next attempt delivers, the job completes on attempt 2, and the stored execution has moved to the chart's next state. The stand-in test stays. The lock move is the lock only; mix.exs is unchanged (the optional requirement stays "~> 0.13", statifier stays "~> 2.5"). Three lock lines moved, as mix deps.update statifier_persistence resolved them: statifier_persistence 0.13.0 -> 0.21.0, statifier 2.7.0 -> 2.9.0 (statifier_persistence 0.21.0 requires "~> 2.9"), predicator 9.0.2 -> 9.4.2. No changelog fragment (a test and a lock move for tests; the package's requirement is unchanged). Full mix quality green on this tree. Refs: sob-8ie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A second parked-timer test,
test/statifier_oban/timer/parked_persisted_execution_test.exs, fires a timer into an execution parked instatifier_persistence's own store, where the existing test beside it (parked_execution_test.exs) runs against a stand-in. The stand-in test stays.The delivery is the README's "Delivering timers to a durable execution" module, defined inside the test over a
StatifierPersistence.Storage.InMemorystore, callingStatifierPersistence.Executions.step/5. The execution runs a small library-loan chart (on_loantakesremindertoreminded).The assertions are the stand-in's:
{:error, {:needs_migration, _}}refusal: the drain reports one failure and no cancel or discard, the job isretryableat attempt 1 with the raise recorded, nothing is delivered, the stored execution is still:needs_migration, and the scope still has one pending timer (Timer.pending_for/2);StatifierPersistence.Executions.unpark/3answers the execution:active;completedat attempt 2, and the machine statestep/5answered hasremindedas its active leaf.The lock move
The lock needed to move for this test:
mix.lockresolvedstatifier_persistence0.13.0, which predates the:needs_migrationstatus andunpark/3(both first shipped in 0.14.0).mix deps.update statifier_persistencemoved these lock lines:statifier_persistence0.13.0 -> 0.21.0statifier2.7.0 -> 2.9.0 (statifier_persistence0.21.0 requires~> 2.9)predicator9.0.2 -> 9.4.2mix.exsis unchanged: the optional requirement stays~> 0.13, andstatifierstays~> 2.5. No other lock line moved, and nothing else in the suite changed.No changelog fragment: a test and a lock move for tests, and the package's requirement is unchanged (
changelog.d/README.mdexcludes test harness changes).Provenance
StatifierPersistence.Storage.InMemory, the package's reference adapter, which ships in itslib/. The Ecto adapter is not used here because this repo's test harness is SQLite and that adapter's gate runs on Postgres. The door under test,Executions.step/5, is the same over either adapter, and so is the refusal it makes from the execution record.StatifierPersistence.Storage.update_execution_status/4writing:needs_migrationwith anilfailure. That is the one write a chart migration's park makes (StatifierPersistence.Executions.migrate/4underon_failure: :park, ADR-0014 decision 1 in that package). The test does not build a migration plan that refuses.Review (own, in-turn)
I re-read the diff against the bead and its dispatch note. The test repeats each of the stand-in's three assertions against the real store. The lock lines that moved are exactly the three listed above, with
mix.exsuntouched. The delivery module inside the test matches the README module's arms one for one; the only additions are the test-pid report and a no-op executor.I ran two sabotage checks, each restored from a copy afterwards. First, the delivery's
needs_migrationarm answered{:discarded, :needs_migration}. Second,StatifierOban.Timer.Worker.perform/1rescued a raise out ofdeliver/2as a discard. Both turned the new test red on the first drain's assertion (cancelled 1, where failure 1 was expected).The full
mix qualitygate is green on the committed tree: every stage passed, and Doctor, Gettext and Sobelow were skipped as not installed.Refs: sob-8ie