You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2023/06/29 22:50:12 UTC
[activemq] 02/02: [AMQ-9258] Update kahadb corruption test to account for new fix from AMQ-9254 (#1007)
This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a commit to branch activemq-5.18.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
commit fa72c13612e816603b42245de54b4d4dc8fc3dcd
Author: Matt Pavlovich <ma...@hyte.io>
AuthorDate: Thu May 18 11:29:01 2023 -0500
[AMQ-9258] Update kahadb corruption test to account for new fix from AMQ-9254 (#1007)
(cherry picked from commit cfbea60d6d4f934e7fbe85915183a2f211414b82)
---
.../store/kahadb/JournalCorruptionEofIndexRecoveryTest.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
index da89e5fd83..d12474523a 100644
--- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
+++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -239,14 +240,20 @@ public class JournalCorruptionEofIndexRecoveryTest {
final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
public void append(LogEvent event) {
+ /**
+ * NOTE: As of JDK v11.0.19 RandomAccessFile throws a messageless EOFException when read fails
+ *
+ * throw new EOFException();
+ */
if (event != null
&& event.getLevel() == Level.WARN
&& event.getMessage() != null
&& event.getMessage().getFormattedMessage() != null
&& event.getMessage().getFormattedMessage().contains("Cannot recover message audit")
&& event.getThrown() != null
- && event.getThrown().getLocalizedMessage() != null
- && event.getThrown().getLocalizedMessage().contains("Invalid location size")) {
+ && event.getThrown() instanceof EOFException
+ && event.getThrown().getMessage() == null) {
+
trappedExpectedLogMessage.set(true);
}
}
@@ -263,6 +270,8 @@ public class JournalCorruptionEofIndexRecoveryTest {
}
assertEquals("no missing message", 50, broker.getAdminView().getTotalMessageCount());
+ assertEquals("Drain", 50, drainQueue(50));
+ assertEquals("no problem draining messages", 0, broker.getAdminView().getTotalMessageCount());
assertTrue("Did replay records on invalid location size", trappedExpectedLogMessage.get());
}