[TEST] Close failable translog in a controlled way otherwise assertions are off in the test

This commit is contained in:
Simon Willnauer 2016-01-08 13:08:40 +01:00
parent 581fd49dac
commit 71796e2319
1 changed files with 6 additions and 0 deletions

View File

@ -1836,6 +1836,12 @@ public class TranslogTests extends ESTestCase {
syncedDocs.clear();
}
}
// we survived all the randomness!!!
// lets close the translog and if it succeeds we are all synced again. If we don't do this we will close
// it in the finally block but miss to copy over unsynced docs to syncedDocs and fail the assertion down the road...
failableTLog.close();
syncedDocs.addAll(unsynced);
unsynced.clear();
} catch (TranslogException | MockDirectoryWrapper.FakeIOException ex) {
// fair enough
} catch (IOException ex) {