-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
feature ➕Tasks that are functional additions or enhancementsTasks that are functional additions or enhancements
Description
Problem
CronJob / workflow_tick fires on real wall-clock time. Tests cannot force-fire a cron workflow iteration without waiting for the next cron tick, making tests:
- Slow: A cron job scheduled for every 60 seconds means tests wait up to 60 seconds per iteration.
- Non-deterministic: Timing-dependent assertions are inherently flaky — CI machines under load may miss windows entirely.
- Hard to debug: Reproducing a cron-related bug requires waiting through real schedule intervals.
Proposal
Add a harness.trigger_cron_job(job_id) method to the test harness that directly invokes the cron handler, bypassing the wall-clock schedule.
// In a test
let harness = BlueprintHarness::new(config).await?;
// Instead of sleeping and hoping the cron fires...
// trigger_cron_job() invokes the handler immediately
let result = harness.trigger_cron_job(MY_CRON_JOB_ID).await?;
// Assert on the result deterministically
assert!(result.is_ok());This would also be useful for debugging — developers could manually trigger cron iterations from a REPL or test script without modifying the schedule.
Context
BlueprintHarness already supports a rich set of test utilities (PR #1283):
with_env_vars()— inject environment variables per-testwith_state_dir_env()— isolated state directorieswith_pre_spawn_hook()— custom setup before spawningMultiHarness— test multiple blueprints and operators togetherOperatorFleet— manage multiple operators per blueprint
Adding trigger_cron_job() would complete the testing toolkit by giving tests full control over time-dependent workflows, making the harness sufficient for all blueprint testing scenarios.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature ➕Tasks that are functional additions or enhancementsTasks that are functional additions or enhancements