ARTEMIS-4279 Improving BAD JDBC Configuration Test

Test was intermittently failing. It does not matter the return code, as long as the process is not alive
This commit is contained in:
Clebert Suconic 2023-05-17 09:56:52 -04:00
parent 3671829993
commit e959e3cfe8
1 changed files with 9 additions and 6 deletions

View File

@ -19,25 +19,28 @@ package org.apache.activemq.artemis.tests.smoke.jdbc;
import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit;
public class JdbcStartupTest extends SmokeTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected static final String SERVER_NAME = "jdbc-bad-driver";
@Test
public void startupBadJdbcConnectionTest() throws Exception {
Integer exitVal = -1;
Process p = startServer(SERVER_NAME, 0, 0);
try {
p.waitFor(10, TimeUnit.SECONDS);
exitVal = p.exitValue();
p.waitFor(20, TimeUnit.SECONDS);
Assert.assertFalse(p.isAlive());
} catch (Exception e) {
Assert.fail();
}
Assert.assertEquals(0, (long) exitVal);
logger.warn(e.getMessage(), e);
Assert.fail(e.getMessage());
}
}
}