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

Check for fatal ledger errors on dispatch task completion #659

Merged
merged 4 commits into from
Aug 14, 2020

Conversation

ianco
Copy link
Contributor

@ianco ianco commented Aug 11, 2020

Signed-off-by: Ian Costanzo [email protected]

@codecov-commenter
Copy link

Codecov Report

Merging #659 into master will decrease coverage by 0.01%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
- Coverage   98.70%   98.68%   -0.02%     
==========================================
  Files         250      250              
  Lines       13389    13393       +4     
==========================================
+ Hits        13215    13217       +2     
- Misses        174      176       +2     

Signed-off-by: Ian Costanzo <[email protected]>
sklump
sklump previously approved these changes Aug 11, 2020
if isinstance(completed.exc_info[1], LedgerConfigError) or isinstance(
completed.exc_info[1], LedgerTransactionError
):
LOGGER.error("Shutdown with %s", str(completed.exc_info[1]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could cover with unit test in test_conductor.py:

    async def test_dispatch_complete_fatal_x(self):
        builder: ContextBuilder = StubContextBuilder(self.test_settings)
        conductor = test_module.Conductor(builder)

        message_body = "{}"
        receipt = MessageReceipt(direct_response_mode="snail mail")
        message = InboundMessage(message_body, receipt)
        mock_task = async_mock.MagicMock(
            exc_info=(test_module.LedgerTransactionError, ("Ledger is wobbly"), "..."),
            ident="abc",
            timing={
                "queued": 1234567890,
                "unqueued": 1234567899,
                "started": 1234567901,
                "ended": 1234567999,
            },
        )

        await conductor.setup()
        conductor.dispatch_complete(message, mock_task)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test added, thanks @sklump !

Signed-off-by: Ian Costanzo <[email protected]>
@sklump
Copy link
Contributor

sklump commented Aug 14, 2020

This looks great, thanks

@sklump sklump self-requested a review August 14, 2020 12:53
@swcurran swcurran merged commit dc1cee7 into openwallet-foundation:master Aug 14, 2020
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.

4 participants