Skip to content

ISO-TP test A_Failing_Subscription_Ends_The_Inbox_With_Its_Failure races the failure report #270

Description

@dborgards

What is the case

IsoTpChannelIntegrationTests.A_Failing_Subscription_Ends_The_Inbox_With_Its_Failure (added in #261) failed once on the ubuntu-latest leg of #269 (run 37143947428, head d9c4eae; the diff there is CANopen only): Expected collection to contain a single item, but the collection is empty., i.e. the last assertion of the test.

The test waits for ReceiveAsync to fault and then reads the list that BackgroundExceptionOccurred fills. RunReaderAsync posts the loss to the inbox first and raises the report afterwards, so the receive can complete before the report has been raised; the assertion then races the raise. The test does not wait for the report, which is a defect in the test (a race of my own making in #261, not of the product code): the product contract is "the inbox ends with the failure, and the failure is reported", with no order promised between them.

Suggested change

Collect the report through a TaskCompletionSource and await it (with the usual timeout) instead of reading the list right after the receive completes.

Test-only. Per the working agreement this is debt from #261 and is worked right after the pull request in hand (#269).

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions