WAR-1255: response stored in data repository through response_ref get stored with control characters#72
Conversation
…framework into bugfix/WAR-1255
|
@navvrnd can you add a detailed description in the JIRA ticket as well as how to test this fix in pull request description? |
|
@navvrnd Can you add sample test case to test this fix in JIRA |
Annam16
left a comment
There was a problem hiding this comment.
Please add sample test case to test this fix in JIRA
|
@navvrnd Can you please add the below details in JIRA ticket.
|
| reobj = re.search(resp_pat_req, response) | ||
| response = reobj.group(0) if reobj is not None else "" | ||
| # removing non-ascii/control characters (line feed) from response | ||
| response = "".join([c for c in response if 31 < ord(c) < 127]) |
There was a problem hiding this comment.
Can you check if you can use "rem_nonprintable_ctrl_chars" method from testcase_utils_class file for removing ascii control chars.
There was a problem hiding this comment.
The function "rem_nonprintable_ctrl_chars" only removes a subset of control characters. I wanted to make it generic. May be we can replace that with this code, but I don't what might break. Please do comment.
There was a problem hiding this comment.
'rem_nonprintable_ctrl_chars' method removes chars with hex values other than 'x20-x7E, x09 & x0A' which is equivalent to accepting decimal values: 32-126, 9(horizontal tab) & 10(new line). I see the difference is only 2 chars(horizontal tab & new line) which we should allow IMO.
Annam16
left a comment
There was a problem hiding this comment.
The attached failure log in JIRA clearly says that, while converting a particular value to the data type "int", exception thrown. And this exception has to be handled in "Framework/Utils/data_Utils.py" "convert2type" method. So kindly add the changes in "convert2type" method.
| try: | ||
| cvalue = convert(value) | ||
| except Exception as exception: | ||
| print_exception(exception) |
There was a problem hiding this comment.
- It would be better if we add the warning message instead of printing the whole exception.
- I see couple of exceptions , one is we are raising and the other one is because of returning "None". Do necessary changes.
- Multiple return statements inside single method. we can assign it to a variable called "status" and handle that value in all the methods where this method is been called already.
|
made the changes requested. Please review. |
…framework into bugfix/WAR-1255
…framework into bugfix/WAR-1255
|
cli full regression log attached in the jira ticket. The following tests failed in the full regression which does not look like issues due to this change:
|
…framework into bugfix/WAR-1255
Annam16
left a comment
There was a problem hiding this comment.
Approving this pull request by testing it with "warrior_fnc_tests/warrior_tests/testcases/cli_tests/other_attr/tc_testdata_relations_verify.xml" by passing different inputs. Working fine.
|
Hi @navvrnd
Hi @kaheichan 10/5 Ka |
|
Upon further investigation in the dummy-td file and the attached td file, I found out that in the dummy-td file This is a user input error that we cannot prevent. The current fix in WAR-1255 will cause issues in the future when the user actually wants to capture non-printable character such as newline. |
…framework into bugfix/WAR-1255
|
Hi @kaheichan addressed all the comments. Please check and approve. 10/12 -Ka 10/13 - Arvind |
| except SyntaxError: | ||
| print_error("Syntax Error - " + | ||
| error_msg2.format(string, value)) | ||
| from WarriorCore.Classes.testcase_utils_class import TestcaseUtils |
There was a problem hiding this comment.
Please put import statement at the beginning of the file
| error_msg2.format(string, value)) | ||
| from WarriorCore.Classes.testcase_utils_class import TestcaseUtils | ||
| tuc_obj = TestcaseUtils() | ||
| print_info("Checking after removing the illegal characters") |
There was a problem hiding this comment.
Please provide a more detailed message
"Cannot convert value: {} into correct format, removing non-printable characters, will attempt conversion again"
There was a problem hiding this comment.
Changed to "Cannot convert below value into correct format, removing non-printable characters, will attempt conversion again" and the actual value in next line, since it mangles the other characters in the string.
|
Hi @navvrnd Hi @kaheichan @navvrnd war-1156 was merged. Please rerun regression and let us know it passed. @kaheichan reran and attached in the ticket. Looks like the code for WAR-1439 is still not yet in which is causing one failure. 10/23 -Ka |
…framework into bugfix/WAR-1255
|
Hi @kaheichan I have attached all pass full regression log in the ticket after commenting out list_range test case which was causing hang. Please let me know, what else to be done for this ticket. |
|
Saw the change and verified the fix, thank you @navvrnd |
response from cli commands stored through response_ref and pattern gets stored with control characters which is causing issues while retrieving later. This was tested with the local team facing the issue and was working fine. For testing, one can take a test case which will store data with control characters in data repository and then retrieve later without any issues.