Fix unstable AudioConsoleTest - #5781
Merged
Merged
Conversation
Use a one-shot test stream instead of a stream with an arbitrary five-second expiration. This prevents slow CI runners from expiring the stream before URLAudioStream connects to it. Assert the captured stream type explicitly and close it after verification so failures are clearer and resources are released. Fixes openhab#3405 Signed-off-by: Wouter Born <github@maindrain.net>
wborn
force-pushed
the
3405-fix-audio-console-test
branch
from
August 16, 2026 09:58
41764ee to
35abb49
Compare
wborn
marked this pull request as ready for review
August 16, 2026 10:14
holgerfriedrich
approved these changes
Aug 18, 2026
holgerfriedrich
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for fixing unstable tests!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fixes the unstable
AudioConsoleTestreported in #3405.The stream tests currently create their local HTTP test stream with a five-second lifetime. That timeout starts when the stream URL is created, not when
URLAudioStreamactually connects to it. On a sufficiently slow or loaded CI runner, the stream can therefore expire before the connection is made.When that happens,
AudioServletremoves the expired stream and the HTTP request fails. ConstructingURLAudioStreamthen throws anAudioException, which is caught byAudioConsoleCommandExtension. Because the audio manager never reaches the sink,AudioSinkFake.audioStreamremainsnull, and the test subsequently fails with the misleadingNullPointerExceptionreported in the issue.The previous increase of this timeout from one to five seconds only reduced the likelihood of the failure; it did not remove the timing dependency.
Changes
serveStream(audioStream)overload in the two console stream tests instead of an arbitrarily expiring stream.URLAudioStreambefore checking its URL, so a future failure reports the real state instead of producing an NPE.URLAudioStreamafter verification.The one-shot stream is a better fit for these tests because they only need a single HTTP access and are not testing stream expiration behavior.
Fixes #3405
Testing
The change is limited to
AudioConsoleTest. The commit and diff were verified against currentmain. A local Maven test run could not be performed in the execution environment because direct outbound access to GitHub is unavailable; the pull request CI will run the repository checks.