Tests: Ensure test does not accidentally create similar data structures

Original commit: elastic/x-pack-elasticsearch@e683de4039
This commit is contained in:
Alexander Reelsen 2017-04-03 16:55:06 +01:00
parent f0364b1218
commit 84f08ee02c
1 changed files with 10 additions and 0 deletions

View File

@ -160,11 +160,21 @@ public class JiraActionTests extends ESTestCase {
} }
if (rarely()) { if (rarely()) {
equals = false; equals = false;
// cover the special case that randomIssueDefaults() left an empty map here as
// well as in the action1, so that those would be equal - make sure they are not
fields = JiraAccountTests.randomIssueDefaults(); fields = JiraAccountTests.randomIssueDefaults();
while (fields.equals(action1.fields)) {
fields = JiraAccountTests.randomIssueDefaults();
}
} }
if (rarely()) { if (rarely()) {
equals = false; equals = false;
// another low probability case, that a random proxy is exactly the same including
// port number
proxy = randomHttpProxy(); proxy = randomHttpProxy();
while (proxy.equals(action1.proxy)) {
proxy = randomHttpProxy();
}
} }
} }