Skip to content

Commit

Permalink
ARTEMIS-4279 Improving BAD JDBC Configuration Test
Browse files Browse the repository at this point in the history
Test was intermittently failing. It does not matter the return code, as long as the process is not alive
  • Loading branch information
clebertsuconic committed May 17, 2023
1 parent 3671829 commit e959e3c
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,28 @@
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();
logger.warn(e.getMessage(), e);
Assert.fail(e.getMessage());
}

Assert.assertEquals(0, (long) exitVal);
}
}

0 comments on commit e959e3c

Please sign in to comment.