Skip to content

test: run the README processing example against PostgreSQL - #4

Merged
lesnik512 merged 1 commit into
mainfrom
test/readme-processing-example
Oct 28, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
test/readme-processing-example

Conversation

@lesnik512

Copy link
Copy Markdown
Member

The README's CreateChatUseCase holds one Transaction and one Inbox per request, as modern-di wires them, so every postgres_retry attempt reuses the same session. The existing db-retry tests open a new session per attempt, so this shape wasn't covered.

Two tests run a copy of the example against PostgreSQL:

  • Retry on the same session. The first attempt claims, writes, then hits a real SerializationError (SQLSTATE 40001, raised with RAISE ... USING ERRCODE). The retry goes through the same Transaction and commits one marker and one business row. With DB_RETRY_RETRIES_NUMBER=1 the test fails, so it passes only because of the retry.
  • Duplicate early return. The same use case processes m-1, then m-1 again (it returns from inside the transaction without committing), then m-2. The duplicate does nothing, the session ends outside a transaction, and m-2 commits normally.

Both passed on the first run, so the README stays as it is.

@lesnik512
lesnik512 merged commit c140df8 into main Oct 28, 2026
13 checks passed
@lesnik512
lesnik512 deleted the test/readme-processing-example branch October 28, 2026 20:56
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