Apache Linkis builds a computation middleware layer to facilitate connection, governance and orchestration between the upper applications and the underlying data engines.
Fix the flaky test detected under the ExceptionManagerTest.java under links-commons module.
Related issues/PRs
Related issues: #5004
Related pr: N/A
Brief change log
There was a map added at the end of the errorException message. Since the HashMap is an unordered data structure, the key-value pair may not stay in the same order every time. That's why sometimes the expected value does not match the actual value. I slightly modified the code to change the HashMap to TreeMap to solve this issue.
The failed log looks like:
[ERROR] Failures:
[ERROR] ExceptionManagerTest.testGenerateException:55 expected: <LinkisException{errCode=10000, desc='The map
cannot be parsed normally, the map is empty or the LEVEL value is missing:(map不能被正常的解析,map为空或者缺少LEVEL值: ){desc=test, ip=null, errCode=1, serviceKind=null, port=0, level=null}', ip='null', port=0, serviceKind='null'}> but was:
<LinkisException{errCode=10000, desc='The map cannot be parsed normally, the map is empty or the LEVEL value is
missing:(map不能被正常的解析,map为空或者缺少LEVEL值: ){port=0, desc=test, level=null, ip=null, errCode=1,
serviceKind=null}', ip='null', port=0, serviceKind='null'}>
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
What is the purpose of the change
Fix the flaky test detected under the
ExceptionManagerTest.java
underlinks-commons
module.Related issues/PRs
Related issues: #5004 Related pr: N/A
Brief change log
There was a map added at the end of the errorException message. Since the HashMap is an unordered data structure, the key-value pair may not stay in the same order every time. That's why sometimes the expected value does not match the actual value. I slightly modified the code to change the HashMap to TreeMap to solve this issue.
The failed log looks like:
After the fix, the failure no longer exists:
Checklist