Skip to content

feat: add Docker/Podman test utilities for conditional test execution#740

Merged
jmesnil merged 1 commit intoa2aproject:mainfrom
kabir:ignore-dockertest-profile
Mar 13, 2026
Merged

feat: add Docker/Podman test utilities for conditional test execution#740
jmesnil merged 1 commit intoa2aproject:mainfrom
kabir:ignore-dockertest-profile

Conversation

@kabir
Copy link
Collaborator

@kabir kabir commented Mar 12, 2026

Add new test-utils-docker module with @RequiresDocker annotation for conditional execution of container-based tests.

Features:

  • Detects both Docker and Podman availability
  • Fails tests when containers unavailable (clear error message)
  • Skips tests with -DskipDockerTests=true system property
  • Modules always compile regardless of container availability
  • No Testcontainers dependency (avoids classpath conflicts)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the testing infrastructure by introducing a dedicated module for managing tests that rely on Docker or Podman. It provides a robust mechanism to conditionally execute, skip, or fail such tests based on the environment's container engine availability and user-defined properties, thereby improving test reliability and developer experience across different environments, including CI/CD pipelines.

Highlights

  • New Module for Docker/Podman Test Utilities: Introduced a new test-utils-docker module to provide JUnit 5 utilities for conditional execution of Docker/Podman-based tests.
  • Conditional Test Execution Annotation: Added the @RequiresDocker annotation, which automatically detects Docker or Podman availability and controls test execution.
  • Robust Handling of Unavailable Container Engines: Implemented logic to fail tests with a clear error message if container engines are unavailable and skipping is not explicitly requested.
  • Flexible Test Skipping: Enabled skipping of Docker-dependent tests using the -DskipDockerTests=true system property, allowing modules to compile regardless of container availability.
  • Dependency Management: Ensured the new utilities have no Testcontainers dependency to avoid potential classpath conflicts.
Changelog
  • boms/sdk/pom.xml
    • Added a2a-java-test-utils-docker as a test dependency.
  • extras/queue-manager-replicated/tests-multi-instance/tests/pom.xml
    • Added a2a-java-test-utils-docker as a test dependency.
  • extras/queue-manager-replicated/tests-multi-instance/tests/src/test/java/io/a2a/extras/queuemanager/replicated/tests/multiinstance/MultiInstanceReplicationTest.java
    • Applied the @RequiresDocker annotation to the test class.
  • extras/queue-manager-replicated/tests-single-instance/pom.xml
    • Added a2a-java-test-utils-docker as a test dependency.
  • extras/queue-manager-replicated/tests-single-instance/src/test/java/io/a2a/extras/queuemanager/replicated/tests/KafkaReplicationIntegrationTest.java
    • Applied the @RequiresDocker annotation to the test class.
  • extras/queue-manager-replicated/tests-single-instance/src/test/java/io/a2a/extras/queuemanager/replicated/tests/ReplicatedQueueManagerTest.java
    • Applied the @RequiresDocker annotation to the test class.
  • pom.xml
    • Added test-utils-docker as a new module to the root pom.xml.
    • Included a2a-java-test-utils-docker in the project's BOM.
  • test-utils-docker/README.md
    • Added a new README file detailing the usage and behavior of the Docker test utilities.
  • test-utils-docker/pom.xml
    • Created a new Maven POM for the a2a-java-test-utils-docker module.
  • test-utils-docker/src/main/java/io/a2a/testutils/docker/DockerAvailability.java
    • Created a new utility class to check for Docker/Podman availability and system property skipDockerTests.
  • test-utils-docker/src/main/java/io/a2a/testutils/docker/DockerRequiredExtension.java
    • Created a new JUnit 5 ExecutionCondition extension to implement conditional test execution logic.
  • test-utils-docker/src/main/java/io/a2a/testutils/docker/RequiresDocker.java
    • Created a new annotation to mark test classes requiring Docker/Podman, linking to DockerRequiredExtension.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a very useful test utility module, test-utils-docker, for conditionally executing tests that depend on Docker or Podman. The implementation using a JUnit 5 extension is clean and the logic for checking container availability and handling the skip property is sound.

I've added a few suggestions to improve thread-safety, debuggability, and documentation accuracy in the new module. Overall, this is a great addition that will improve the testing experience in different environments.

@kabir
Copy link
Collaborator Author

kabir commented Mar 12, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a very useful test utility for conditionally running Docker-based tests. The implementation is clean and well-documented. I've made a few suggestions to improve the robustness and align the behavior of the skip flag with common user expectations. Specifically, I've recommended that the -DskipDockerTests=true flag should always cause tests to be skipped, regardless of whether Docker is available. I've also suggested adding a timeout when checking for Docker/Podman to prevent the build from hanging. Overall, this is a great addition to the project's testing infrastructure.

@kabir
Copy link
Collaborator Author

kabir commented Mar 12, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a well-designed utility for conditionally executing tests that require Docker or Podman. The new test-utils-docker module with the @RequiresDocker annotation is a great addition for improving the test execution experience in different environments. The implementation is clean and the feature is well-documented in the new README file.

I've found an area for improvement in DockerAvailability.java concerning exception handling, for which I've left a specific comment.

@kabir
Copy link
Collaborator Author

kabir commented Mar 12, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test-utils-docker module to conditionally execute tests based on Docker/Podman availability. The implementation is solid, using a JUnit 5 ExecutionCondition to check for a container runtime and a system property to allow skipping tests. The new @RequiresDocker annotation is applied to existing container-based tests, improving the test execution experience in environments without Docker. My review includes one suggestion to improve the robustness of the Docker/Podman detection logic by ensuring process output streams are handled correctly to prevent potential hangs.

Add new test-utils-docker module with @RequiresDocker annotation for
conditional execution of container-based tests.

Features:
- Detects both Docker and Podman availability
- Fails tests when containers unavailable (clear error message)
- Skips tests with -DskipDockerTests=true system property
- Modules always compile regardless of container availability
- No Testcontainers dependency (avoids classpath conflicts)

Applied to:
- extras/queue-manager-replicated/tests-single-instance
- extras/queue-manager-replicated/tests-multi-instance/tests
@kabir kabir force-pushed the ignore-dockertest-profile branch from bce54fa to 87f622b Compare March 12, 2026 20:31
@kabir
Copy link
Collaborator Author

kabir commented Mar 12, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful test utility for conditionally executing Docker-based tests. The implementation is solid, creating a new test-utils-docker module with a @RequiresDocker annotation and a corresponding JUnit 5 extension. The utility correctly detects Docker and Podman, and provides a clear mechanism for skipping tests. The code is well-structured and documented. I have one minor suggestion to slightly improve the double-checked locking implementation for clarity and performance.

@jmesnil jmesnil merged commit 4cf9867 into a2aproject:main Mar 13, 2026
11 checks passed
@jmesnil
Copy link
Collaborator

jmesnil commented Mar 13, 2026

@kabir thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants