Skip to content

test: add comprehensive test suite (180+ tests, 20 benchmarks)#1

Merged
namuan merged 1 commit into
mainfrom
task-2d849ecd-extensive-testing
May 30, 2026
Merged

test: add comprehensive test suite (180+ tests, 20 benchmarks)#1
namuan merged 1 commit into
mainfrom
task-2d849ecd-extensive-testing

Conversation

@namuan

@namuan namuan commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a rigorous automated testing suite for the durable workflow engine, expanding coverage from 25 tests to 180+ tests + 20 benchmarks across 9 new test files organized by domain.

New test files

File Tests Coverage
engine_schema_test.go 16 Table existence, columns, indexes, defaults, PRAGMAs, foreign keys, STRICT
engine_state_machine_test.go 30 All state transitions, invariants, version tracking, lease lifecycle, ID edge values
engine_concurrency_test.go 15 Goroutine racing leases, worker pools, concurrent signals/timers/steps, fairness
engine_edge_cases_test.go 30 Nil payloads, large step numbers, nonexistent workflows, empty queues, timer edges
engine_recovery_test.go 10 Crash with lease, mid-step, multi-workflow, signal/timer persistence, reopen
engine_event_sourcing_test.go 15 Sequence continuity, all event types, monotonicity, isolation, state replay
engine_complex_scenarios_test.go 12 Full saga with retry, signal triggers, chained timers, interleaved workflows
engine_scheduler_test.go 14 Timer fire, future protection, lease expiry, continuous run, cancellation
engine_benchmarks_test.go 20 Throughput for create/acquire/step/signal/timer, concurrent variants, full lifecycle

Other changes

  • Added QueryCompleted() method to Engine (follows existing pattern)
  • Updated README with testing documentation section
  • All tests pass with -race enabled

Adds 9 test files covering:
- Schema validation (tables, columns, indexes, PRAGMAs, foreign keys)
- State machine completeness (all transitions, invariants, version tracking)
- Concurrency (multi-goroutine lease races, worker pools, stress tests)
- Edge cases (nil payloads, boundary values, nonexistent workflows)
- Crash recovery (mid-step, multi-workflow, signal/timer persistence)
- Event sourcing (sequence continuity, replay, isolation, all event types)
- Complex scenarios (sagas with retry, chained timers, signal-as-trigger)
- Scheduler behavior (timer firing, lease expiry, cancellation, idling)
- Performance benchmarks for all critical paths

Also adds QueryCompleted to Engine and updates README with test docs.
@namuan namuan merged commit 09cc3df into main May 30, 2026
2 checks passed
@namuan namuan deleted the task-2d849ecd-extensive-testing branch May 30, 2026 14:45
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.

1 participant