You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "testfixer0 (Jira)" <ji...@apache.org> on 2020/02/07 20:33:00 UTC

[jira] [Comment Edited] (HADOOP-16847) Test can fail if HashSet iterates in a different order

    [ https://issues.apache.org/jira/browse/HADOOP-16847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032039#comment-17032039 ] 

testfixer0 edited comment on HADOOP-16847 at 2/7/20 8:32 PM:
-------------------------------------------------------------

The method `testNegativeGroupCaching` can fail if the iteration order of HashSet changes. In detail, the method `assertEquals` (line 331) compares `groups.getGroups(user)` with a ArrayList `myGroups`. The method `getGroups` converts `allGroups` (a HashSet) to a list and it calls iterator in HashSet. However, the iteration is non-deterministic.

This PR proposes to modify HashSet to LinkedHashSet for a deterministic order.


was (Author: testfixer):
The method `testNegativeGroupCaching` can fail if the iteration order of HashSet changes. So, this PR proposes to modify HashSet to LinkedHashSet for a deterministic order

> Test can fail if HashSet iterates in a different order
> ------------------------------------------------------
>
>                 Key: HADOOP-16847
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16847
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: security
>    Affects Versions: 3.2.1
>            Reporter: testfixer0
>            Priority: Minor
>         Attachments: HADOOP-16847-000.patch, HADOOP-16847-000.patch
>
>
> The method `testNegativeGroupCaching` can fail if the iteration order of HashSet changes. In detail, the method `assertEquals` (line 331) compares `groups.getGroups(user)` with a ArrayList `myGroups`. The method `getGroups` converts `allGroups` (a HashSet) to a list and it calls iterator in HashSet. However, the iteration is non-deterministic.
> This PR proposes to modify HashSet to LinkedHashSet for a deterministic order.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org