Skip to content

test: cover schedule:run and schedule:work and pin framework#1572 - #177

Merged
hwbrzzl merged 2 commits into
masterfrom
run-20261118-152238
Nov 18, 2026
Merged

hwbrzzl merged 2 commits into
masterfrom
run-20261118-152238

Conversation

@goravel-agent

Copy link
Copy Markdown
Contributor

Summary

  • Add a tests/feature/schedule_test.go suite that proves schedule:run executes every event due in the current minute exactly once per external trigger and then exits, asserting exact counts per event (EveryMinute, EverySecond, a 0 0 30 2 * expression that can never be due, and an @every 1h event).
  • Prove schedule:work stays up: a sub-minute event reaches a second run before Shutdown stops the loop, the command returns only after shutdown, and schedule:work is registered on the app. The suite claims the only cron loop through app.disabled_runners.
  • Pin github.com/goravel/framework to master HEAD v1.18.1-0.20261118072219-cc4bb811d18e in both require and replace, with go.sum regenerated.

Why

schedule:run and schedule:work had no feature coverage, so the difference between them was only implied by the framework source: one runs the due events for the current tick and returns, the other keeps following the schedule until it is shut down. This suite pins that behavior down for goravel/framework#1572 with exact per-event counts, and uses an EverySecond event as the pivot — a single tick can only ever reach one run, so a count of two is proof that schedule:work really keeps ticking, while a zero for the never-due expression and the @every 1h event shows unrelated events are left alone. Because the boot-time scheduler would otherwise be a second loop in the same process, the suite disables goravel:schedule and owns the only cron loop itself.

The dependency moves to framework master HEAD, which also carries the unrelated queue fix #1618; no drift showed up in the neighbouring suites (TestQueueMultiQueueTestSuite, TestConsoleTestSuite, TestDisabledRunnersTestSuite all pass on this pin), so nothing outside the new test was touched.

WithSchedule(func() []schedule.Event {
	return []schedule.Event{
		// Only `schedule:work` follows a sub-minute cadence, so this event
		// fires again on the next tick instead of once per `schedule:run`.
		facades.Schedule().Call(func() {
			facades.Log().Info("Scheduled Task Executed")
		}).EverySecond().Name("app:heartbeat"),
	}
})

@goravel-agent
goravel-agent requested a review from a team as a code owner November 18, 2026 08:42
@hwbrzzl
hwbrzzl merged commit dda7866 into master Nov 18, 2026
9 checks passed
@hwbrzzl
hwbrzzl deleted the run-20261118-152238 branch November 18, 2026 08:56
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.

2 participants