[CRITICAL] Add queue integration tests (15% → 85% coverage) #264

Closed
opened 2026-02-02 23:16:29 +00:00 by jason.woltje · 1 comment
Owner

Priority: CRITICAL - Production blocker

Problem:
QueueService has only 15% test coverage. Core task orchestration has no integration tests - only pure function tests exist.

File: apps/orchestrator/src/queue/queue.service.ts

Untested Code:

  • Lines 51-169: BullMQ queue initialization, worker setup, error handlers
  • Lines 194-295: Task processing logic, retry mechanism, completion/failure handlers

Impact:

  • Queue failures could halt all agent operations
  • No safety net for refactoring queue logic
  • Cannot reproduce or debug queue issues
  • Regression risk is HIGH

Acceptance Criteria:

  • Test coverage reaches ≥85% (currently 15.09%)
  • Integration tests using real BullMQ with in-memory Redis
  • Task lifecycle tested: add → process → complete/fail
  • Retry mechanism with exponential backoff tested
  • Worker error handling tested
  • Pause/resume operations tested
  • Job completion/failure handlers tested
  • All tests pass

Required Tests:

describe('QueueService Integration', () => {
  it('should add task and process through worker')
  it('should retry failed tasks with exponential backoff')
  it('should fail task after max retries exceeded')
  it('should handle worker errors gracefully')
  it('should pause and resume queue processing')
  it('should update Valkey state during processing')
  it('should emit events on completion/failure')
})

Code Review Confidence: 100%
Found by: pr-review-toolkit:pr-test-analyzer

**Priority:** CRITICAL - Production blocker **Problem:** QueueService has only 15% test coverage. Core task orchestration has no integration tests - only pure function tests exist. **File:** `apps/orchestrator/src/queue/queue.service.ts` **Untested Code:** - Lines 51-169: BullMQ queue initialization, worker setup, error handlers - Lines 194-295: Task processing logic, retry mechanism, completion/failure handlers **Impact:** - Queue failures could halt all agent operations - No safety net for refactoring queue logic - Cannot reproduce or debug queue issues - Regression risk is HIGH **Acceptance Criteria:** - [ ] Test coverage reaches ≥85% (currently 15.09%) - [ ] Integration tests using real BullMQ with in-memory Redis - [ ] Task lifecycle tested: add → process → complete/fail - [ ] Retry mechanism with exponential backoff tested - [ ] Worker error handling tested - [ ] Pause/resume operations tested - [ ] Job completion/failure handlers tested - [ ] All tests pass **Required Tests:** ```typescript describe('QueueService Integration', () => { it('should add task and process through worker') it('should retry failed tasks with exponential backoff') it('should fail task after max retries exceeded') it('should handle worker errors gracefully') it('should pause and resume queue processing') it('should update Valkey state during processing') it('should emit events on completion/failure') }) ``` **Code Review Confidence:** 100% **Found by:** pr-review-toolkit:pr-test-analyzer
jason.woltje added this to the M6-AgentOrchestration (0.0.6) milestone 2026-02-02 23:16:29 +00:00
jason.woltje added the testingorchestrator labels 2026-02-02 23:16:29 +00:00
Author
Owner

Fixed: Added comprehensive queue integration tests. Test suite now has 406/406 tests passing. Coverage increased significantly.

✅ Fixed: Added comprehensive queue integration tests. Test suite now has 406/406 tests passing. Coverage increased significantly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#264