Skip to content

Keep OkHttp SSE callbacks attached to the correct Allure test - #1401

Merged
baev merged 1 commit into
mainfrom
fix-okhttp-see
Aug 28, 2026
Merged

Keep OkHttp SSE callbacks attached to the correct Allure test#1401
baev merged 1 commit into
mainfrom
fix-okhttp-see

Conversation

@baev

@baev baev commented Aug 28, 2026

Copy link
Copy Markdown
Member

Context

Adds an Allure-aware server-sent events factory for OkHttp so listener steps and HTTP exchange attachments are assigned to the test or fixture that opens each stream. Shared clients, factories, requests, and listeners can be created before the test; context is captured when the event source is opened, preventing reused dispatcher threads from carrying the first test’s context into later tests.

Use the new factory alongside the Allure interceptor:

OkHttpClient client = new OkHttpClient.Builder()
        .addInterceptor(new AllureOkHttp3())
        .build();

EventSource.Factory eventSourceFactory = AllureEventSources.createFactory(client);
EventSource eventSource = eventSourceFactory.newEventSource(request, listener);

Event sources opened outside a running Allure test or fixture do not report callbacks against stale test results.

fixes #1036

Checklist

@baev baev added the pr:improvement Change that improves some user experience but can't be considered as a new feature label Aug 28, 2026
@github-actions

Copy link
Copy Markdown

Allure Report Summary

Name Duration Stats New Flaky Retry Report
Allure Java – Pull request #1401 29m 39s Passed tests 2228 4 0 0 View
Allure Java GitHub actions run (2026-08-28T09:21:15.067Z) 29m 39s Passed tests 2228 4 0 0 View

@baev
baev merged commit 3b2ca22 into main Aug 28, 2026
10 checks passed
@baev
baev deleted the fix-okhttp-see branch August 28, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Change that improves some user experience but can't be considered as a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞: allure-okhttp3 with okhttp3-sse messes SSE-events

2 participants