Skip to content

Commit

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

Signed-off-by: Valentin Mitrofanov <mitrofmep@gmail.com>

* fix #6625 - reverse assertEquals params

Signed-off-by: Valentin Mitrofanov <mitrofmep@gmail.com>

---------

Signed-off-by: Valentin Mitrofanov <mitrofmep@gmail.com>
  • Loading branch information
mitrofmep committed Apr 20, 2023
1 parent e791d46 commit 4afc914
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2904,7 +2904,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 @@ -3226,13 +3228,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 4afc914

Please sign in to comment.