Skip to content

E2E test: Subscribe with OffsetSpec::offset(N) — resume from specific offset#308

Closed
s2x wants to merge 1 commit intomainfrom
oda-153-e2e-test-subscribe-with-offsetspec-offse
Closed

E2E test: Subscribe with OffsetSpec::offset(N) — resume from specific offset#308
s2x wants to merge 1 commit intomainfrom
oda-153-e2e-test-subscribe-with-offsetspec-offse

Conversation

@s2x
Copy link
Copy Markdown
Contributor

@s2x s2x commented Mar 30, 2026

Closes #153

Problem

SubscribeTest covers OffsetSpec::first(), last(), and next(), but never tests OffsetSpec::offset(N) with a concrete offset value. This is the most common production scenario — consumers resuming from a stored offset after restart.

Expected test

public function testSubscribeFromSpecificOffset(): void
{
    // 1. Publish 10 messages (offsets 0-9)
    // 2. Subscribe with OffsetSpec::offset(5)
    // 3. Verify only messages from offset 5+ are received
    // 4. Verify the first received message has offset >= 5
}

Why it matters

  • This is the primary production use case for stream consumers
  • OffsetSpec::offset() serializes differently (TYPE_OFFSET = 0x0004 with uint64 value)
  • Without this test, offset-based resume could silently break

Acceptance criteria

  • Publish N messages, subscribe from offset M, verify only messages from M+ arrive
  • Test with offset 0 (should behave like first())
  • Test with offset beyond stream end (should receive no messages until new ones arrive)

…153

Add three test methods to SubscribeTest.php:
- testSubscribeFromSpecificOffset(): verifies subscribing from offset 5 receives messages 5-9
- testSubscribeFromOffsetZero(): verifies offset 0 behaves like first()
- testSubscribeFromOffsetBeyondEnd(): verifies behavior when offset exceeds stream length

Tests follow the established pattern from OsirisChunkParserE2ETest and validate
the primary production use case for stream consumers (resuming from stored offset).
@s2x s2x closed this Mar 30, 2026
@s2x s2x deleted the oda-153-e2e-test-subscribe-with-offsetspec-offse branch March 30, 2026 13:32
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.

E2E test: Subscribe with OffsetSpec::offset(N) — resume from specific offset

1 participant