From 9cdbcbd121008702f78a776ac8f4d91c1a9056ac Mon Sep 17 00:00:00 2001 From: Stuart Tettemer Date: Wed, 18 Dec 2019 14:23:21 -0700 Subject: [PATCH] [TEST] Exclude name on ScriptContextInfo mutate (#50332) (#50337) ScriptContextInfoSerializingTests:testEqualsAndHashcode was failing because the mutation was generating the same name. **Backport** Fixes: #50331 --- .../storedscripts/ScriptContextInfoSerializingTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/ScriptContextInfoSerializingTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/ScriptContextInfoSerializingTests.java index b00fadfc68c..7c91ce79464 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/ScriptContextInfoSerializingTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/ScriptContextInfoSerializingTests.java @@ -56,7 +56,10 @@ public class ScriptContextInfoSerializingTests extends AbstractSerializingTestCa } private static ScriptContextInfo mutate(ScriptContextInfo instance, Set names) { - if (names == null) { names = new HashSet<>(); } + if (names == null) { + names = new HashSet<>(); + names.add(instance.name); + } switch (randomIntBetween(0, 2)) { case 0: return new ScriptContextInfo(