Fix FAIL_ON_METHOD in MetaDataStateFormatTests
fail method should be computed before eval, not inside it
This commit is contained in:
parent
b20497560c
commit
e8289167ee
|
@ -506,10 +506,10 @@ public class MetaDataStateFormatTests extends ESTestCase {
|
||||||
protected Directory newDirectory(Path dir) {
|
protected Directory newDirectory(Path dir) {
|
||||||
MockDirectoryWrapper mock = newMockFSDirectory(dir);
|
MockDirectoryWrapper mock = newMockFSDirectory(dir);
|
||||||
if (failureMode == FailureMode.FAIL_ON_METHOD) {
|
if (failureMode == FailureMode.FAIL_ON_METHOD) {
|
||||||
|
final String failMethod = randomFrom(failureMethods);
|
||||||
MockDirectoryWrapper.Failure fail = new MockDirectoryWrapper.Failure() {
|
MockDirectoryWrapper.Failure fail = new MockDirectoryWrapper.Failure() {
|
||||||
@Override
|
@Override
|
||||||
public void eval(MockDirectoryWrapper dir) throws IOException {
|
public void eval(MockDirectoryWrapper dir) throws IOException {
|
||||||
String failMethod = randomFrom(failureMethods);
|
|
||||||
for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
|
for (StackTraceElement e : Thread.currentThread().getStackTrace()) {
|
||||||
if (failMethod.equals(e.getMethodName())) {
|
if (failMethod.equals(e.getMethodName())) {
|
||||||
throw new MockDirectoryWrapper.FakeIOException();
|
throw new MockDirectoryWrapper.FakeIOException();
|
||||||
|
|
Loading…
Reference in New Issue