Skip to content

Add ojp-testcontainers integration test and CI job#380

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-integration-test-ojp-testcontainers
Draft

Add ojp-testcontainers integration test and CI job#380
Copilot wants to merge 2 commits intomainfrom
copilot/create-integration-test-ojp-testcontainers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 8, 2026

The ojp-testcontainers module had no integration test and was never exercised in CI, meaning changes to OjpContainer could silently break without detection.

Changes

  • New OjpContainerIntegrationTest — single integration test gated by -DenableOjpContainerTests=true; starts an OjpContainer, asserts isRunning(), verifies TCP connectivity on the mapped OJP port, and validates getOjpConnectionString() output:
@EnabledIf("org.openjproxy.testcontainers.OjpContainerIntegrationTest#isEnabled")
class OjpContainerIntegrationTest {
    static boolean isEnabled() {
        return Boolean.parseBoolean(System.getProperty("enableOjpContainerTests", "false"));
    }

    @Test
    void testContainerStartsAndIsReachable() throws IOException {
        try (OjpContainer container = new OjpContainer()) {
            container.start();
            assertTrue(container.isRunning());
            try (Socket socket = new Socket()) {
                socket.connect(new InetSocketAddress(container.getOjpHost(), container.getOjpPort()), 5_000);
                assertTrue(socket.isConnected());
            }
            assertEquals(container.getOjpHost() + ":" + container.getOjpPort(),
                         container.getOjpConnectionString());
        }
    }
}
  • OjpContainerTest — guard Docker-starting teststestStartAndGetConnectionInfo and testContainerIsReady now carry the same @EnabledIf annotation so mvn test no longer pulls Docker images unconditionally.

  • New ojp-testcontainers-test CI job — runs after build-test, installs the module from local source first (ensuring latest code), then runs the integration test:

- name: Build and Install (ojp-testcontainers) locally
  run: mvn clean install -pl ojp-testcontainers -am -DskipTests -Dgpg.skip=true

- name: Run OJP TestContainers Integration Tests
  run: mvn test -pl ojp-testcontainers -Dgpg.skip=true -DenableOjpContainerTests=true

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 8, 2026

Copilot AI changed the title [WIP] Add integration test for ojp-testcontainers module Add ojp-testcontainers integration test and CI job Mar 8, 2026
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