Skip to content

Conversation

CodingPythonMan
Copy link
Contributor

@CodingPythonMan CodingPythonMan commented May 2, 2025

Previous error messages were unclear when ExpectNextNAsync failed, especially in tests (e.g., with Kafka). The new message includes the exact index of the mismatch and shows both expected and actual values.

Old:
"Expected one of (1, 2, 3, ...), but got '5'"

New:
"Expected element at index 24 to be '25', but got '5'"

This improves debugging clarity for stream-based tests and addresses developer confusion in cases with large input sequences.

Fixes #7536

Changes

Updated ExpectNextNTask to provide clearer error messages with exact mismatch index and values.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Previous error messages were unclear when ExpectNextNAsync failed, especially in tests (e.g., with Kafka).
The new message includes the exact index of the mismatch and shows both expected and actual values.

Old:
  "Expected one of (1, 2, 3, ...), but got '5'"

New:
  "Expected element at index 24 to be '25', but got '5'"

This improves debugging clarity for stream-based tests.
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Copy link
Member

You had a racy spec failure here and it's one of the tests we're working on fixing in #7615 and #7579, so not your code's fault

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 2, 2025 16:21
@Aaronontheweb Aaronontheweb merged commit 98ebc72 into akkadotnet:dev May 2, 2025
11 checks passed
@Aaronontheweb
Copy link
Member

@CodingPythonMan congrats on your first contribution to Akka.NET 🥳

@CodingPythonMan
Copy link
Contributor Author

Thank you so much, @Aaronontheweb 🙏
I’m really glad to hear that the failure wasn’t caused by my change, and I appreciate your kind words.
This was a fun one to work on — I learned quite a bit, and I’m excited to keep exploring and contributing where I can!

@Arkatufus Arkatufus added this to the 1.5.41 milestone May 6, 2025
This was referenced Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Akka.Streams.TestKit: ExpectNextNAsync unfriendly error message

3 participants