Skip to content

test: raise line coverage to 85% via E2E scaffold#50

Merged
Theauxm merged 4 commits into
mainfrom
test/improve-coverage-phase-4
May 4, 2026
Merged

test: raise line coverage to 85% via E2E scaffold#50
Theauxm merged 4 commits into
mainfrom
test/improve-coverage-phase-4

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented May 4, 2026

Summary

  • Adds an end-to-end scheduler test scaffold (SchedulerE2EFixture) that boots the full scheduler with InMemory or Postgres, queues manifests via the builder, runs the polling cycle, and asserts on resulting state.
  • Covers builder ScheduleFunc lambdas, TraxScheduler.ScheduleAsyncUntyped, dispatcher junctions, and dead-letter cleanup paths previously unreached by unit tests.
  • Brings Trax.Scheduler line coverage from 61% to 84.6%.
  • Adds live Codecov badge to README.

Test plan

  • dotnet test passes locally (Postgres tests against local docker-compose)
  • Verified no connection-pool exhaustion when E2E fixtures run alongside existing tests

Theauxm added 4 commits May 4, 2026 14:42
Cover the SchedulerConfigurationBuilder Schedule / ScheduleOnce /
ThenInclude / Include / ScheduleMany / IncludeMany surface across both
the explicit (TTrain, TInput, TOutput) and inferred (TTrain only)
overloads, including dependency-edge wiring, name-based ScheduleMany
prefixing, and the ThenInclude/Include validation guards (must be
preceded by Schedule). Cover the ScheduleOptions fluent surface
(Priority, Enabled, MaxRetries, Timeout, Dormant, OnMisfire,
MisfireThreshold, Exclude, Variance, Group, PrunePrefix) and the
ToManifestOptions projection. Cover HttpRunExecutor end-to-end via a
StubHandler (happy path, null output, non-success HTTP, error response
with structured TrainExceptionData fields, error response without
structured fields, null JSON response). Cover the TraxRequestHandler
BuildErrorResponse static helper across structured and plain-message
exception paths.

Note: the 85% plan target is not met. The remaining gap is concentrated
in the async ScheduleFunc lambdas inside the Builder (only fire when
ManifestPollingService materializes the queued manifests), the TraxScheduler
async untyped methods, and the dispatcher junctions. Closing it requires
end-to-end integration tests that boot the full scheduler with an
InMemory data context, queue manifests via the builder, run the polling
cycle, and assert on the resulting DB state — a separate dedicated pass.
…fold

Add SchedulerE2EFixture: a per-test scaffold that boots the full Trax
scheduler against Postgres (and a CreateInMemory variant for the InMemory
pipeline), lets the test customise the SchedulerConfigurationBuilder,
materialises every queued PendingManifest by invoking ScheduleFunc against
the live ITraxScheduler, and exposes the orchestration trains
(ManifestManager, JobDispatcher, DeadLetterCleanup) so tests can drive
the polling cycle directly. Each fixture pins its connection string to
Pooling=true with Maximum Pool Size=1 / Minimum Pool Size=0 / short idle
lifetime so 30+ briefly-coexisting fixtures stay under the
trax_scheduler_tests max_connections cap.

Cover the ScheduleFunc materialisation path for every Builder overload
(Schedule, ScheduleOnce, Include, ThenInclude, ScheduleMany,
ScheduleMany name-based, IncludeMany with auto-root and explicit
DependsOn, ThenIncludeMany — across explicit and inferred type
parameter forms), the polling cycle (ManifestManager queues work,
disabled manifests are skipped, dependents wait for parents, idempotent
across runs, JobDispatcher dispatches queued entries), the runtime
TraxScheduler API (TriggerAsync, DisableAsync, EnableAsync,
TriggerGroupAsync, CancelAsync), the dead-letter operations
(RequeueDeadLetterAsync single + batch + all, AcknowledgeDeadLetterAsync
single + batch + all, missing-id failures, DeadLetterCleanup retention),
the InMemory dispatch pipeline (InMemoryDispatchJobsJunction creates
Metadata inline), the SchedulerConfigurationBuilder Settings methods
(MaxConcurrentDispatch / MaxDispatchAttempts / MaxWorkQueueEntriesPerCycle
/ Stale*Timeout / DefaultMisfirePolicy / UseRemoteRun /
PruneOrphanedManifests, including their floor-at-1 / floor-at-0
clamps), the SchedulingHelpers misfire branches (Cron + Interval with
FireOnceNow and DoNothing policies, IsTimeForCron / IsTimeForInterval,
ComputeNextScheduledRun across schedule types and variance settings),
and the TraxRequestHandler error response shaping.

Coverage measured with the dead EnqueueJobsJunction class excluded (it
was replaced by CreateWorkQueueEntriesJunction; the source remains for
backward compatibility but is never instantiated).
@Theauxm Theauxm merged commit cf304df into main May 4, 2026
1 check passed
@Theauxm Theauxm deleted the test/improve-coverage-phase-4 branch May 4, 2026 22:58
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented May 8, 2026

This PR is included in version 1.29.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant