From 84f08ee02ca4c72aca8e53bddb23c84ab6722a73 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Mon, 3 Apr 2017 16:55:06 +0100 Subject: [PATCH] Tests: Ensure test does not accidentally create similar data structures Original commit: elastic/x-pack-elasticsearch@e683de40393b95b75dab61e189696b93aae6bc8c --- .../xpack/watcher/actions/jira/JiraActionTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java index 7440644a0f2..6bc5a700690 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java @@ -160,11 +160,21 @@ public class JiraActionTests extends ESTestCase { } if (rarely()) { 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(); + while (fields.equals(action1.fields)) { + fields = JiraAccountTests.randomIssueDefaults(); + } } if (rarely()) { equals = false; + // another low probability case, that a random proxy is exactly the same including + // port number proxy = randomHttpProxy(); + while (proxy.equals(action1.proxy)) { + proxy = randomHttpProxy(); + } } }