You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2023/12/05 15:14:30 UTC
(activemq-artemis) branch main updated: ARTEMIS-4526 Moving ShutdownOnCriticalIOErrorMoveNextTest into integration-tests-isolated
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new ffaa057ce1 ARTEMIS-4526 Moving ShutdownOnCriticalIOErrorMoveNextTest into integration-tests-isolated
ffaa057ce1 is described below
commit ffaa057ce1d68c1a3ee2e8e4bc8ba6d47c19fdba
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Dec 5 09:31:42 2023 -0500
ARTEMIS-4526 Moving ShutdownOnCriticalIOErrorMoveNextTest into integration-tests-isolated
ShutdownOnCriticalIOErrorMoveNextTest was actually my "inspiration" to have created the isolated tests module in the first place, so it would be reasonable to move it there as well.
the issue comes down to the test simulating a server failure where the server would go down abruptly causing the VM to drop / exit. In this test the nature of failure is leaving a partial shutdown where server executors are still hanging around causing a cascade leak of server pools still running.
So it is completely expected to have these threads "leaking". Hence this test should be moved into the isolated-tests.
there is no semantic / server change as part of this task. It's just moving a test to a better place.
---
.../ShutdownOnCriticalIOErrorMoveNextTest.java | 60 +++++++---------------
1 file changed, 18 insertions(+), 42 deletions(-)
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
similarity index 72%
rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
rename to tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
index 4073557b9b..a80d3b6615 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
+++ b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.artemis.tests.integration.critical;
+package org.apache.activemq.artemis.tests.integration.isolated.critical;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -22,7 +22,6 @@ import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import java.io.File;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.api.core.Message;
@@ -40,59 +39,37 @@ import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.tests.util.Wait;
-import org.apache.activemq.artemis.utils.SpawnedVMSupport;
+import org.apache.activemq.artemis.utils.Wait;
import org.junit.Assert;
import org.junit.Test;
public class ShutdownOnCriticalIOErrorMoveNextTest extends ActiveMQTestBase {
- private static final int OK = 3;
-
- public static void main(String[] arg) {
- ShutdownOnCriticalIOErrorMoveNextTest testInst = new ShutdownOnCriticalIOErrorMoveNextTest();
- // some methods are not static, so we need an instance
- testInst.testSimplyDownAfterErrorSpawned();
- }
-
@Test
public void testSimplyDownAfterError() throws Exception {
- Process process = SpawnedVMSupport.spawnVM(ShutdownOnCriticalIOErrorMoveNextTest.class.getName());
- runAfter(process::destroyForcibly);
- Assert.assertTrue(process.waitFor(10, TimeUnit.SECONDS));
- Assert.assertEquals(OK, process.exitValue());
- }
-
- public void testSimplyDownAfterErrorSpawned() {
- try {
- deleteDirectory(new File("./target/server"));
- ActiveMQServer server = createServer("./target/server");
+ disableCheckThread();
+ deleteDirectory(new File("./target/server"));
+ ActiveMQServer server = createServer("./target/server");
- server.start();
+ server.start();
- ConnectionFactory factory = new ActiveMQConnectionFactory();
- Connection connection = factory.createConnection();
+ ConnectionFactory factory = new ActiveMQConnectionFactory();
+ Connection connection = factory.createConnection();
- Session session = connection.createSession();
+ Session session = connection.createSession();
- MessageProducer producer = session.createProducer(session.createQueue("queue"));
+ MessageProducer producer = session.createProducer(session.createQueue("queue"));
- try {
- for (int i = 0; i < 500; i++) {
- producer.send(session.createTextMessage("text"));
- }
- } catch (JMSException expected) {
+ try {
+ for (int i = 0; i < 500; i++) {
+ producer.send(session.createTextMessage("text"));
}
-
- Wait.waitFor(() -> !server.isStarted());
-
- Assert.assertFalse(server.isStarted());
- System.exit(OK);
- } catch (Throwable e) {
- e.printStackTrace(System.out);
- System.exit(-1);
+ } catch (JMSException expected) {
}
+ Wait.waitFor(() -> !server.isStarted());
+
+ Assert.assertFalse(server.isStarted());
}
ActiveMQServer createServer(String folder) throws Exception {
@@ -144,8 +121,7 @@ public class ShutdownOnCriticalIOErrorMoveNextTest extends ActiveMQTestBase {
Configuration createConfig(String folder) throws Exception {
Configuration configuration = createDefaultConfig(true);
- configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging").
- setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false);
+ configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging").setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false);
configuration.setSecurityEnabled(false);
configuration.setPersistenceEnabled(true);