From e8289167ee75122d22aa0c8d6aeaf0a8332a964c Mon Sep 17 00:00:00 2001 From: Andrey Ershov Date: Wed, 5 Dec 2018 14:59:41 +0100 Subject: [PATCH] Fix FAIL_ON_METHOD in MetaDataStateFormatTests fail method should be computed before eval, not inside it --- .../org/elasticsearch/gateway/MetaDataStateFormatTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/org/elasticsearch/gateway/MetaDataStateFormatTests.java b/server/src/test/java/org/elasticsearch/gateway/MetaDataStateFormatTests.java index a7f24cdba3a..2522452f727 100644 --- a/server/src/test/java/org/elasticsearch/gateway/MetaDataStateFormatTests.java +++ b/server/src/test/java/org/elasticsearch/gateway/MetaDataStateFormatTests.java @@ -506,10 +506,10 @@ public class MetaDataStateFormatTests extends ESTestCase { protected Directory newDirectory(Path dir) { MockDirectoryWrapper mock = newMockFSDirectory(dir); if (failureMode == FailureMode.FAIL_ON_METHOD) { + final String failMethod = randomFrom(failureMethods); MockDirectoryWrapper.Failure fail = new MockDirectoryWrapper.Failure() { @Override public void eval(MockDirectoryWrapper dir) throws IOException { - String failMethod = randomFrom(failureMethods); for (StackTraceElement e : Thread.currentThread().getStackTrace()) { if (failMethod.equals(e.getMethodName())) { throw new MockDirectoryWrapper.FakeIOException();