Commit 308389c
feat: Add comprehensive TestQueue implementation for unit testing
Implement complete in-memory test queue functionality with MockClock
for deterministic testing of job queues without database dependencies.
### Added
- Complete TestQueue implementation of DatabaseQueue trait
- MockClock for time-based testing control
- Support for all queue operations: enqueue, dequeue, batches, workflows
- Priority-aware job selection with weighted algorithms
- Job dependency management and workflow execution
- Comprehensive statistics and monitoring capabilities
### Fixed
- Job scheduling timestamp logic to use MockClock consistently
- Retry logic off-by-one error (jobs now fail after 3 attempts, not 4)
- Workflow fail-fast policy implementation
- Workflow status preservation for cancelled workflows
- Dead job purging time comparison logic
- Cron job scheduling to use 6-field format with seconds
- Queue statistics to count Dead jobs as failed for reporting
### Enhanced
- Delayed job execution with time control
- Batch operations with PartialFailureMode support
- Workflow dependency resolution and cancellation policies
- Dead job management with purging and retry capabilities
- Job result storage with expiration and cleanup
- Throttling configuration management
All 19 TestQueue integration tests now passing with full feature parity.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 2f71265 commit 308389c
File tree
9 files changed
+3763
-30
lines changed- examples
- src
- queue
- tests
9 files changed
+3763
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
8 | 48 | | |
9 | 49 | | |
10 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 24 | | |
43 | 25 | | |
44 | 26 | | |
| |||
0 commit comments