-
Notifications
You must be signed in to change notification settings - Fork 144
Fix JSON decoding in AlgodHTTPError #223
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
Conversation
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.
I agree looks as a fix.
|
👍, I'll try to run (and fix if needed) unit tests before merging. |
|
Failed with Please double check if it related to the fix somehow. The code def validate_error(context, err):
if context.expected_status_code != 200:
if context.expected_status_code == 500:
assert context.expected_mock_response == json.loads(err.args[0]) # <--- !!! HERE !!!
else:
raise NotImplementedError("test does not know how to validate status code " + context.expected_status_code)
else:
raise err
@when('we make any "{client}" call to "{endpoint}".')
def step_impl(context, client, endpoint):
# with the current implementation of mock responses, there is no need to do an 'endpoint' lookup
if client == "indexer":
try:
context.response = context.icl.health()
except error.IndexerHTTPError as err:
validate_error(context, err)
elif client == "algod":
try:
context.response = context.acl.status()
except error.AlgodHTTPError as err:
validate_error(context, err) # <--- !!! HERE !!!
else:
raise NotImplementedError('did not recognize client "' + client + '"') |
|
Thank you @algochoi! @algorandskiy, fixed the same issue in the indexer and adapted integration tests to match. All green from my side! |
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.
This looks good to me, thank you for fixing this
* Fix JSON decoding in AlgodHTTPError * Add logging around error * Apply same fix to indexer * Fix integration tests
The following would always raise an exception in the
tryblock and raise the second exception from theexceptwithout parsing the JSONmessagereceived in the HTTP response.If the intent was to decode the JSON in the exception, this PR fixes the behaviour. Before:
After:
I have added a small integration test, but I can't run the Docker tests because
indexerfails to build (locally and on CI).