Aurélien Pupier created CAMEL-28088:
---------------------------------------
Summary: camel-activemq6: use a singleton test-infra service
Key: CAMEL-28088
URL: https://issues.apache.org/jira/browse/CAMEL-28088
Project: Camel
Issue Type: Sub-task
Components: tests, test-infra
Reporter: Aurélien Pupier
Sub-task of CAMEL-28075: use a singleton test-infra service in
{{camel-activemq6}} (rank 13 in the priority order).
h3. Analysis for this module
* Container/service starts today: 3 classes
* Average start time: 6.8s ({{quay.io/artemiscloud/activemq-artemis-broker}})
* Estimated saving by sharing one instance: about 14s
h3. What to change
Same as camel-activemq: {{ActiveMQITSupport}} builds its own service with
{{MessagingServiceFactory.builder()}}, with no singleton in
{{test-infra/camel-test-infra-messaging-common}}. Do it together with, or
after, the camel-activemq subtask to share the singleton.
h3. Check that a fresh container is not required
Use unique queue/topic names per test and make sure no test leaves messages
another test reads.
h3. Stability first
Moving a test class to a singleton service must *not* make the build less
stable. Before switching a class:
* check that the test does not require a fresh container: it must not stop,
shut down, pause, restart or reconfigure the service (or its container) and
must not depend on an empty initial state;
* make the data it creates unique per test (queue/topic/bucket/secret/parameter
names, consumer groups, ...) so that tests sharing the same instance, in the
same JVM, do not interfere, including when test classes run concurrently;
* leave tests that really need a fresh instance on {{createService()}} (and
document why in a comment);
* run the module several times (for example with
{{-Dcamel.failsafe.forkCount=N}} and, where supported,
{{-Dcamel.surefire.parallel=true}}) and compare the duration and the failure
rate with the current ones before opening the PR.
_AI-generated by IBM Bob on behalf of apupier._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)