Skip to content

Commit

Permalink
Fix LocalTranslogTests.testWithRandomException test scenario (#6748) (#…
Browse files Browse the repository at this point in the history
…7263)

* fix #6625



* fix #6625 - reverse assertEquals params



---------


(cherry picked from commit 4afc914)

Signed-off-by: Valentin Mitrofanov <mitrofmep@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 556bd04 commit c63cb04
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2908,7 +2908,9 @@ ChannelFactory getChannelFactory() {
void deleteReaderFiles(TranslogReader reader) {
if (fail.fail()) {
// simulate going OOM and dying just at the wrong moment.
throw new RuntimeException("simulated");
RuntimeException e = new RuntimeException("simulated");
tragedy.setTragicException(e);
throw e;
} else {
super.deleteReaderFiles(reader);
}
Expand Down Expand Up @@ -3230,13 +3232,13 @@ public void testWithRandomException() throws IOException {
syncedDocs.addAll(unsynced);
unsynced.clear();
} catch (TranslogException | MockDirectoryWrapper.FakeIOException ex) {
assertEquals(failableTLog.getTragicException(), ex);
assertEquals(ex, failableTLog.getTragicException());
} catch (IOException ex) {
assertEquals(ex.getMessage(), "__FAKE__ no space left on device");
assertEquals(failableTLog.getTragicException(), ex);
assertEquals(ex, failableTLog.getTragicException());
} catch (RuntimeException ex) {
assertEquals(ex.getMessage(), "simulated");
assertEquals(failableTLog.getTragicException(), ex);
assertEquals(ex, failableTLog.getTragicException());
} finally {
Checkpoint checkpoint = Translog.readCheckpoint(config.getTranslogPath());
if (checkpoint.numOps == unsynced.size() + syncedDocs.size()) {
Expand Down

0 comments on commit c63cb04

Please sign in to comment.