Revert "ARTEMIS-3509 Improving assertions on StompTest"

Sorry for the spam, I pushed this commit by mistake / accident

This reverts commit db0a0975bb.
This commit is contained in:
Clebert Suconic 2024-07-24 10:41:50 -04:00
parent db0a0975bb
commit e50c73eac9
5 changed files with 14 additions and 22 deletions

View File

@ -190,7 +190,7 @@ public class RealServerTestBase extends ActiveMQTestBase {
recreateDirectory(homeInstance + "/log");
}
protected boolean findLogRecord(File logFile, boolean matchAnyValue, String... values) throws Exception {
protected boolean findLogRecord(File logFile, String... values) throws Exception {
assertTrue(logFile.exists());
boolean hasRecord = false;
try (BufferedReader reader = new BufferedReader(new FileReader(logFile))) {
@ -200,17 +200,13 @@ public class RealServerTestBase extends ActiveMQTestBase {
boolean hasAll = true;
for (int i = 1; i < values.length; i++) {
if (!line.contains(values[i])) {
if (matchAnyValue) {
logger.warn("value {} ", values[i], new Exception("trace"));
return true;
}
hasAll = false;
break;
}
}
if (hasAll) {
hasRecord = true;
logger.debug("log found: {}", line);
logger.debug("audit found: {}", line);
break;
}
}

View File

@ -94,7 +94,7 @@ public class AuditLoggerTest extends AuditLoggerTestBase {
Wait.waitFor(() -> addressControl.getMessageCount() == 1);
assertEquals(1, addressControl.getMessageCount());
assertTrue(findLogRecord(getAuditLog(), false, "sending a message", uniqueStr));
assertTrue(findLogRecord(getAuditLog(),"sending a message", uniqueStr));
//failure log
address = RandomUtil.randomSimpleString();
@ -117,9 +117,9 @@ public class AuditLoggerTest extends AuditLoggerTestBase {
//ignore
}
assertTrue(findLogRecord(getAuditLog(), false, "AMQ601264: User guest", "gets security check failure, reason = AMQ229213: User: guest does not have permission='DELETE_NON_DURABLE_QUEUE'"));
assertTrue(findLogRecord(getAuditLog(),"AMQ601264: User guest", "gets security check failure, reason = AMQ229213: User: guest does not have permission='DELETE_NON_DURABLE_QUEUE'"));
//hot patch not in log
assertTrue(findLogRecord(getAuditLog(), false, "is sending a message"));
assertTrue(findLogRecord(getAuditLog(),"is sending a message"));
}
@Test
@ -182,10 +182,10 @@ public class AuditLoggerTest extends AuditLoggerTestBase {
Wait.waitFor(() -> addressControl.getMessageCount() == 2);
assertEquals(2, addressControl.getMessageCount());
assertFalse(findLogRecord(getAuditLog(), false, "messageID=0"));
assertTrue(findLogRecord(getAuditLog(), false, "sent a message"));
assertTrue(findLogRecord(getAuditLog(), false, uniqueStr));
assertTrue(findLogRecord(getAuditLog(), false, "Hello2"));
assertFalse(findLogRecord(getAuditLog(), "messageID=0"));
assertTrue(findLogRecord(getAuditLog(), "sent a message"));
assertTrue(findLogRecord(getAuditLog(), uniqueStr));
assertTrue(findLogRecord(getAuditLog(), "Hello2"));
connection.start();
MessageConsumer consumer = session.createConsumer(session.createQueue(address.toString()));
@ -196,7 +196,7 @@ public class AuditLoggerTest extends AuditLoggerTestBase {
} finally {
connection.close();
}
Wait.assertTrue(() -> findLogRecord(getAuditLog(), false, "is consuming a message from"), 5000);
Wait.assertTrue(() -> findLogRecord(getAuditLog(), false, "acknowledged message from"), 5000);
Wait.assertTrue(() -> findLogRecord(getAuditLog(), "is consuming a message from"), 5000);
Wait.assertTrue(() -> findLogRecord(getAuditLog(), "acknowledged message from"), 5000);
}
}

View File

@ -92,7 +92,8 @@ public class NettyNativeTest extends SmokeTestBase {
}
File artemisLog = new File("target/" + SERVER_NAME + "/log/artemis.log");
assertTrue(findLogRecord(artemisLog, true, "Acceptor using native", "Acceptor using nio"));
assertTrue(findLogRecord(artemisLog, "Acceptor using native"));
assertFalse(findLogRecord(artemisLog, "Acceptor using nio"));
}
}

View File

@ -187,7 +187,7 @@ public class ClusterNotificationsContinuityTest extends SoakTestBase {
String serverName = SERVER_NAME_BASE + i;
File artemisLog = new File("target/" + serverName + "/log/artemis.log");
assertFalse(findLogRecord(artemisLog, false, "AMQ224037"));
assertFalse(findLogRecord(artemisLog, "AMQ224037"));
}
}

View File

@ -52,8 +52,6 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
public class StompSoakTest extends SoakTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@ -181,8 +179,5 @@ public class StompSoakTest extends SoakTestBase {
}
Assertions.assertEquals(0, errors.get());
File artemisLog = new File("target/" + SERVER_NAME_0 + "/log/artemis.log");
assertFalse(findLogRecord(artemisLog, true, "AMQ222151", "ConcurrentModificationException"));
}
}