Add createSingletonService() to test-infra factories and migrate tests#22294
Draft
gnodet wants to merge 2 commits intoapache:mainfrom
Draft
Add createSingletonService() to test-infra factories and migrate tests#22294gnodet wants to merge 2 commits intoapache:mainfrom
gnodet wants to merge 2 commits intoapache:mainfrom
Conversation
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Add singleton service support to test-infra service factories that were missing it. This allows test classes to share a single container instance per JVM, reducing Docker overhead and preparing the infrastructure for safe within-JVM parallel test execution. Each factory now provides: - A SingletonXxxService inner class extending SingletonService<T> - A lazy-init SingletonServiceHolder using static initializer - A createSingletonService() factory method Factories updated: AzureStorageBlob, AzureStorageQueue, Cassandra, Consul, Docling, GooglePubSub, Hashicorp, Hazelcast, IbmMQ, Iggy, Ignite, Keycloak, McpEverything, McpEverythingSse, MicroprofileLRA, Minio, Mosquitto, Nats, Openldap, Postgres, PostgresVector, RabbitMQ, Redis, Solr, TensorFlowServing, Triton, Xmpp. ZooKeeper excluded: requires unique container naming (PR apache#22287) first, since camel-zookeeper and camel-zookeeper-master both create containers named "camel-zookeeper" and collide in parallel CI builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4061f61 to
36d7b4f
Compare
Contributor
|
LGTM, but this one likely needs a full CI test to make sure it runs fine. |
Where safe, migrate test base classes to use createSingletonService() so tests share a single container instance, reducing Docker overhead. Tests left on createService() are annotated with comments explaining why they cannot share a singleton container (state interference, conflicting declarations, or container name collisions from auth-variant containers). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Yes, I'm running tests locally for each modified factory to make sure it works. It's not completely done yet... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
createSingletonService()to 27 test-infra service factories and migrate 36 test classes to use them where safe.Phase 2: Factory methods (commit 1)
SingletonXxxServiceinner class,SingletonServiceHolderlazy init, andcreateSingletonService()factory method to 27 service factoriesKafkaServiceFactorytemplatePhase 3: Test migrations (commit 2)
createService()tocreateSingletonService()createService()are annotated with comments explaining why they cannot share a singleton container:Motivation
Singleton services allow test classes within a module to share a single container instance, reducing Docker overhead and test execution time. Combined with PR #22287 (unique container naming), this makes the test infrastructure safe for within-JVM parallel execution.
Test plan