test: raise line coverage to 85% via E2E scaffold#50
Merged
Conversation
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).
|
This PR is included in version 1.29.0 |
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.
Summary
SchedulerE2EFixture) that boots the full scheduler with InMemory or Postgres, queues manifests via the builder, runs the polling cycle, and asserts on resulting state.TraxScheduler.ScheduleAsyncUntyped, dispatcher junctions, and dead-letter cleanup paths previously unreached by unit tests.Test plan
dotnet testpasses locally (Postgres tests against local docker-compose)