Skip to main content

Tests: internal/formation

internal/formation · 61 tests

Each test is named for the property it holds, and runs against a real deployment: there is no mock of the database and no arm that skips when it is absent. The sentence is the test's name read back; the name is what go test -run takes.

attempts_test.go

  • An attempt is counted when the turn is claimedTestAnAttemptIsCountedWhenTheTurnIsClaimed. An attempt is counted when the turn is claimed, so an attempt that takes the worker with it still costs one.
  • A name the store cannot keep is a refusal not a failed turnTestANameTheStoreCannotKeepIsARefusalNotAFailedTurn. A name the store cannot keep is a refusal, not a failed turn: the rest of the turn forms, the claim is recorded with its reason, and nothing is retried.

compaction_internal_test.go

  • Material over the ceiling is cut from the oldest turn and the cut is countedTestMaterialOverTheCeilingIsCutFromTheOldestTurnAndTheCutIsCounted. Material over the ceiling loses its oldest turns until it fits, and the count of what went is reported; a single turn is never cut away, because a segment written from nothing is not a segment.

compaction_test.go

  • The compaction pass rolls up a history one bounded call at a timeTestTheCompactionPassRollsUpAHistoryOneBoundedCallAtATime. The pass writes at most its limit of segments per call, climbs one level when a run of segments is full, and stops when the history is rolled up; a summariser that fails is counted, not fatal; no summariser writes nothing.
  • The driver runs the compaction pass after drainingTestTheDriverRunsTheCompactionPassAfterDraining. The driver runs the projection passes after draining a scope, so a deployment writes segments without an operator running anything; the pass counts appear in what the driver did.

formation_test.go

  • A turn is formed and its facts cite their own messagesTestATurnIsFormedAndItsFactsCiteTheirOwnMessages. ── A turn is formed and its facts cite their own messages ──────────────────────────────────── A turn is appended, formed, and its facts read back with evidence whose spans resolve against the messages they came from.
  • An assistant message in a users turn forms no fact for the principalTestAnAssistantMessageInAUsersTurnFormsNoFactForThePrincipal. ── The role is the message's, never the turn's ─────────────────────────────────────────────── The role is the MESSAGE's, never the turn's.
  • The formed watermark never runs past an unformed turnTestTheFormedWatermarkNeverRunsPastAnUnformedTurn. ── Stored is not formed, and the watermark cannot run past a gap ───────────────────────────── Stored is not formed, and the formed watermark cannot run past a gap.
  • A second worker on the same scope is turned awayTestASecondWorkerOnTheSameScopeIsTurnedAway. ── One worker per scope ────────────────────────────────────────────────────────────────────── One worker per scope.
  • Formation records what the vocabulary refusedTestFormationRecordsWhatTheVocabularyRefused. What the vocabulary refused is written down, so its rate is a query rather than an estimate.
  • A turn that will not form is parked with its reason keptTestATurnThatWillNotFormIsParkedWithItsReasonKept. A turn that fails every time is parked, and parking is legible without reading a log.
  • A parked turn does not freeze the scope behind itTestAParkedTurnDoesNotFreezeTheScopeBehindIt. A parked turn does not hold the scope.
  • Unparking returns the turn and corrects the watermarkTestUnparkingReturnsTheTurnAndCorrectsTheWatermark. Parking is a decision, not a deletion.
  • A cancelled drain does not spend the turns attemptsTestACancelledDrainDoesNotSpendTheTurnsAttempts. A shutdown is not a bad turn.
  • The driver finds scopes it was never told aboutTestTheDriverFindsScopesItWasNeverToldAbout. The driver finds scopes rather than being told them, which is the only way a project created after it started gets formed.
  • A scope that fails does not stop the others formingTestAScopeThatFailsDoesNotStopTheOthersForming. One project's bad turn does not hold up another project's memory.
  • The driver forms a scope without anybody asking itTestTheDriverFormsAScopeWithoutAnybodyAskingIt. The driver forms without anybody asking it to.
  • A second driver does not form the same turn twiceTestASecondDriverDoesNotFormTheSameTurnTwice. Two drivers over one instance do not form the same turn twice.
  • Recording a failure against a formed or absent turn is a no opTestRecordingAFailureAgainstAFormedOrAbsentTurnIsANoOp. Recording a failure against a turn that formed in the meantime is not an error.
  • The driver sweeps retentionTestTheDriverSweepsRetention. The driver sweeps retention as well as forming, on its own schedule.
  • Only projects with due stored deadlines are sweptTestOnlyProjectsWithDueStoredDeadlinesAreSwept. Stored deadlines determine whether a project has due work, including after its current policy becomes indefinite.
  • A pass reports what it could not doTestAPassReportsWhatItCouldNotDo. A driver pass keeps going when one scope fails, and reports that it did.
  • A cancelled pass stopsTestACancelledPassStops. A cancelled pass stops rather than working through the remaining scopes.
  • A turn with two current values forms with one fact and one refusalTestATurnWithTwoCurrentValuesFormsWithOneFactAndOneRefusal. A message that gives one single-cardinality relation two current values forms rather than parks: the first value is the fact, the second is a refusal with its own reason, and the watermark moves.
  • A claim refused by role is recorded with its reasonTestAClaimRefusedByRoleIsRecordedWithItsReason. A refusal by role is a row, not only a number: an operator reading what a document was refused sees the assistant's first-person claims beside the other reasons.
  • A worker that dies strands neither the scope nor the turnTestAWorkerThatDiesStrandsNeitherTheScopeNorTheTurn. ── A worker that dies strands nothing ──────────────────────────────────────────────────────── A worker that dies strands nothing.

health_test.go

ingestionbudget_test.go

notifications_test.go

  • The pass does nothing without a destination and stops when the store failsTestThePassDoesNothingWithoutADestinationAndStopsWhenTheStoreFails. ── The notification pass ───────────────────────────────────────────────────────────────────── A deployment with no permitted destination does nothing at all, and a store that fails stops the pass rather than being swallowed — a delivery whose failure nobody hears about is the shape of promise this whole mechanism exists to avoid making.

pipeline_test.go

pipelinefailure_test.go

projectrebuild_test.go

quietproject_test.go

rebuild_test.go

rebuildintegrity_test.go

rebuildretry_test.go

retentionscheduling_test.go

subjectretention_test.go

subjects_test.go