Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ledger-api-test-tool: Provide context when expecting a failing Future. #8690

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

ghost
Copy link

@ghost ghost commented Jan 29, 2021

We use Future#failed a lot in the conformance tests. Usually, this works fine, but it has the unfortunate effect of yielding a useless error message when the future was actually a success:

Future.failed not completed with a throwable.

Combined with the lack of useful stack traces, because futures, this makes the test failure completely useless.

This changes all calls of Future#failed in our conformance tests to use a new extension method, #mustFail, which takes a mandatory "context" parameter to provide context, and includes both the context and the value in the future in case of success.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

We use `Future#failed` a _lot_ in the conformance tests. Usually, this
works fine, but it has the unfortunate effect of yielding a useless
error message when the future was actually a success:

```
Future.failed not completed with a throwable.
```

Combined with the lack of useful stack traces, because futures, this
makes the test failure completely useless.

This changes all calls of `Future#failed` in our conformance tests to
use a new extension method, `#mustFail`, which takes a mandatory
"context" parameter to provide context, and includes both the context
and the value in the future in case of success.

CHANGELOG_BEGIN
CHANGELOG_END
@ghost ghost requested review from gerolf-da and rautenrieth-da as code owners January 29, 2021 12:21
@ghost ghost requested review from fabiotudone-da and miklos-da January 29, 2021 12:21
Copy link
Contributor

@fabiotudone-da fabiotudone-da left a comment

Choose a reason for hiding this comment

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

That's a significant usability improvement, thanks!

@ghost ghost added the automerge label Jan 29, 2021
@mergify mergify bot merged commit 0d1bc4b into main Jan 29, 2021
@mergify mergify bot deleted the samir/ledger/ledger-api-test-tool/better-errors branch January 29, 2021 13:37
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.

2 participants