-
Notifications
You must be signed in to change notification settings - Fork 515
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
Conversation
Signed-off-by: Ian Costanzo <ian@anon-solutions.ca>
Codecov Report
@@ 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 <ian@anon-solutions.ca>
if isinstance(completed.exc_info[1], LedgerConfigError) or isinstance( | ||
completed.exc_info[1], LedgerTransactionError | ||
): | ||
LOGGER.error("Shutdown with %s", str(completed.exc_info[1])) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 <ian@anon-solutions.ca>
This looks great, thanks |
Signed-off-by: Ian Costanzo ian@anon-solutions.ca