bmk15897 opened a new pull request, #403: URL: https://github.com/apache/skywalking-java/pull/403
## Description Flaky Test found using [NonDex](https://github.com/TestingResearchIllinois/NonDex) by running the command - mvn -pl apm-commons/apm-util edu.illinois:nondex-maven-plugin:1.1.2:nondex The logged failure - ``` [ERROR] Failures: [ERROR] ConfigInitializerTest.testInitialize:70 arrays first differed at element [1]; expected:<[b]> but was:<[c]> ``` ## Investigation The test fails at `ConfigInitializerTest.testInitialize:70` with the error regarding a mismatch of elements of the expected array of Strings with the actual elements from the `TestPropertiesObject.Level1Object.SET_STR_ATTR.toArray()` on line 70. The SET_STR_ATTR is a SET and a set does not guarantee the order of its elements. According to the [documentation](https://docs.oracle.com/javase/8/docs/api/java/util/Set.html), the toArray() function follows the iterator's order and the iterator returns elements in no particular order (unless this set is an instance of some class that provides a guarantee). This makes the test outcome non-deterministic. To fix this, the actual array needs to be sorted so that it can guarantee the order of its elements. Similar fix is made for the line `ConfigInitializerTest.testInitialize:71` to remove the flakiness. ## Fix Sorting the output returned by the toArray() function. This removes the non-determinism without needing any further changes and ensures that the flakiness of the test is removed. - [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>. - [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking-java/blob/main/CHANGES.md). -- 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]
