NO-JIRA Fixing intermittent failure on ActiveMQServerControlUsingCoreTest

This failure was because of a noise from the test itself. as the test is creating a producer, and it's measuring for a producer from the test.
it makes no sense to fix it for OverCore.. we just ignore it on UsingCore
This commit is contained in:
Clebert Suconic 2023-03-08 12:06:07 -05:00
parent 3032bb9b0f
commit ed5322c54f
2 changed files with 22 additions and 1 deletions

View File

@ -42,6 +42,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
@ -4747,6 +4748,14 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
}
}
private int getNumberOfProducers(ActiveMQServer server) {
AtomicInteger producers = new AtomicInteger();
server.getSessions().forEach(session -> {
producers.addAndGet(session.getProducerCount());
});
return producers.get();
}
@Test
public void testListProducersAgainstServer() throws Exception {
SimpleString queueName1 = new SimpleString("my_queue_one");
@ -4770,6 +4779,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
ClientProducer producer1 = session1.createProducer(addressName1);
producer1.send(session1.createMessage(true));
Wait.assertEquals(1, () -> getNumberOfProducers(server));
//bring back all producers
String filterString = createJsonFilter("", "", "");
String producersAsJsonString = serverControl.listProducers(filterString, 1, 50);
@ -4780,6 +4791,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
JsonObject jsonSession = array.getJsonObject(0);
Wait.assertTrue(() -> server.getSessionByID(jsonSession.getString(ProducerField.SESSION.getName())) != null);
//get the only server producer
ServerProducer producer = server.getSessionByID(jsonSession.getString(ProducerField.SESSION.getName())).getServerProducers().iterator().next();
//check all fields

View File

@ -22,6 +22,8 @@ import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.api.core.management.Parameter;
import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -34,7 +36,14 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
extraProducers = 1;
}
@Override
@Test
public void testListProducersAgainstServer() throws Exception {
// have to disable this test, as it's dealing with producers objects.
// the test itself will be using a producer to manage the server.
// so the test will include noise and it might fail occasionally
Assume.assumeTrue(false);
}
// ActiveMQServerControlTest overrides --------------------------
// the core messaging proxy doesn't work when the server is stopped so we cant run these 2 tests