Framework.Test.SequenceGapSimulator (Framework v0.5.0)
View SourceSimulates sequence gaps for testing consumer gap tolerance.
Creates gaps in the sequence by reserving sequence numbers in transactions that are then rolled back, simulating real-world scenarios where operations fail after sequence allocation.
Summary
Functions
Create a sequence gap by reserving and rolling back.
Create multiple sequence gaps in succession.
Get current sequence value without consuming it.
Get next sequence value that would be allocated.
Functions
Create a sequence gap by reserving and rolling back.
This simulates a real scenario where:
- Transaction begins and reserves nextval('outbox_sequence')
- Some operation fails (validation, constraint, etc.)
- Transaction rolls back, leaving a gap in the sequence
The gap tests that consumers handle missing sequence numbers correctly.
Create multiple sequence gaps in succession.
Get current sequence value without consuming it.
Useful for test verification and debugging.
Get next sequence value that would be allocated.
Uses nextval() to advance and return the sequence. Only use in tests since this consumes a sequence number.