DMTF / Redfish-Protocol-Validator

The Redfish Protocol Validator tests the HTTP protocol behavior of a Redfish service to validate that it conforms to the Redfish specification.
Other
14 stars 12 forks source link

Redfish-Protocol-Validator getting stopped in-between in latest version. #76

Closed AfrinrasfiyaM closed 4 months ago

AfrinrasfiyaM commented 5 months ago

Hi,

I can run the test with Tag 1.2.1 successfully.

But when I run the test with Tag 1.2.2 or master, the test is getting stopped. The test was not completed but got error here.

Error:
DEBUG:urllib3.connectionpool:https://172.31.96.168:443 "DELETE /redfish/v1/SessionService/Sessions/16b19644b521f25fa2200dee90c56178 HTTP/1.1" 204 0 Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/rf_protocol_validator.py", line 9, in main() File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/redfish_protocol_validator/console_scripts.py", line 99, in main perform_tests(sut) File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/redfish_protocol_validator/console_scripts.py", line 37, in perform_tests security_details.test_security_details(sut) File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/redfish_protocol_validator/security_details.py", line 1089, in test_security_details test_authentication(sut) File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/redfish_protocol_validator/security_details.py", line 1072, in test_authentication test_password_change_required(sut) File "/home/crb/redfish_protocol_2.1.3/Redfish-Protocol-Validator/redfish_protocol_validator/security_details.py", line 842, in test_password_change_required data = response.json() File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

So can you please conform that this is a tool issue or our redfish stack implementation issue?

Thanks Afrin RasfiyaM

mraineri commented 5 months ago

It's possibly either; there is a long-standing issue we need to resolve in general with handling response bodies that aren't proper JSON (see issue #40).

In this particular test, it's modifying a ManagerAccount resource and looking at the PATCH response body. Are you able to check what HTTP status code and the response body you're returning when a user performs a PATCH to /redfish/v1/AccountService/Accounts/{AccountId}? I see where the exception was thrown it'll look for response.ok before trying to do JSON decoding, but I think 204 No Content might fall into that case, which would have no JSON response at all; this would be a tool bug. However, if you're returning 200 OK with a non-JSON body, that would be a service bug.

plmanik commented 4 months ago

@mraineri Service is returning 204 No Content for patch to /redfish/v1/AccountService/Accounts/{AccountId}. This was working with earlier version 1.2.1 and unable to use last three versions 1.2.2, 1.2.3, 1.2.4 due to this error. Please let us know plan for fixing this issue from tool side

Thanks, Mani

plmanik commented 4 months ago

Thanks @mraineri for adding changes, we will try with the changes