bee0511 opened a new issue, #2485:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2485
## Bug Report
### Which version of ElasticJob did you use?
Latest master branch (commit: 4acbf77d3fc05f3c4f484c38b06d6aed786e5974)
### Expected behavior
The test
`ElasticJobExecutorTest.assertExecuteFailureWhenThrowExceptionForMultipleShardingItems`
should pass consistently regardless of the internal ordering of HashMap
entries.
### Actual behavior
The test fails intermittently with the following error:
```[ERROR]
ElasticJobExecutorTest.assertExecuteFailureWhenThrowExceptionForMultipleShardingItems:127->assertExecuteFailureWhenThrowException:138
Argument(s) are different! Wanted:
jobFacade.postJobStatusTraceEvent(
"fake_task_id",
TASK_ERROR,
"{0=java.lang.RuntimeException
, 1=java.lang.RuntimeException
}"
);
Actual invocations have different arguments:
jobFacade.postJobStatusTraceEvent(
"fake_task_id",
TASK_ERROR,
"{1=java.lang.RuntimeException
, 0=java.lang.RuntimeException
}"
);
```
### Reason analyze (If you can)
In `ElasticJobExecutor.java`, the `itemErrorMessages` is a
`ConcurrentHashMap<Integer, String>` (initialized in constructor):
When this map is converted to a string via `toString()`, the iteration order
is non-deterministic. This causes the error message format to vary between
executions (e.g., {0=..., 1=...} or {1=..., 0=...}).
The test method `getErrorMessage` only generates the expected string with a
fixed order {0=..., 1=...}, which fails when the HashMap's internal ordering
produces {1=..., 0=...}.
### Steps to reproduce the behavior.
Run the test multiple by using
[NonDex](https://github.com/TestingResearchIllinois/NonDex):
`mvn -pl kernel edu.illinois:nondex-maven-plugin:2.2.1:nondex
-DnondexRuns=10`
The test will fail intermittently depending on the HashMap's internal
ordering
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]