[JIRA] (JENKINS-61024) Test fails due to a different iteration order

2 views
Skip to first unread message

contextshuffling@gmail.com (JIRA)

unread,
Feb 9, 2020, 4:13:03 PM2/9/20
to jenkinsc...@googlegroups.com
Context Shuffling created an issue
 
Jenkins / Bug JENKINS-61024
Test fails due to a different iteration order
Issue Type: Bug Bug
Assignee: Unassigned
Components: core
Created: 2020-02-09 21:12
Priority: Minor Minor
Reporter: Context Shuffling

Test "hudson.util.ArgumentListBuilderTest#assertKeyValuePairsWithMask" creates an ArgumentListBuilder, add several key value pairs, and mask the second key ("key2").

Following is key part of the implementation of "ArgumentListBuilder.addKeyValuePairs"

...
for (Entry<String,String> e : props.entrySet()) {
    addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask != null) && propsToMask.contains(e.getKey()));
}
...

The loop here iterates using props.entrySet, where props in this test is a HashMap. However, HashMap's entrySet does not have a deterministic iteration order and thus, test fails if the order of iteration is not as expected in the test, which is actually the insertion order.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages