Skip to content

Conversation

@kfaraz
Copy link
Contributor

@kfaraz kfaraz commented Jul 16, 2025

Changes

  • Add extension druid-testcontainers that can be later published as an individual module for Testcontainers
  • Add DruidContainer - Testcontainer impl for running individual Druid services
  • Add DruidContainerResource to allow use of DruidContainer in embedded cluster tests
  • Make minor modifications to EmbeddedDruidServer and EmbeddedDruidCluster to support
    running both embedded servers and container-based services in the same cluster
  • Add job to run the *DockerTests (2 right now, this number should remain small over time).

Note: Usage of DruidContainer will not be the norm but the exception to test out backward compatibility
and/or Docker related changes only. All other use cases should continue to use EmbeddedDruidServers.

Pending items

Advantages

  • Can be used to run embedded tests against the distribution Docker image as opposed to the current ITs
    which use a custom IT-only image
  • Takes us 1 step closer to completely removing the old IT frameworks
  • Leverages all the benefits of the embedded test framework while also testing out the Docker containers
  • Can be easily used for backward compatibility tests

Next steps

  • Once we have phased out the old ITs, all integration tests will be based on EmbeddedClusterTestBase
  • Most of these tests will just use EmbeddedDruidServer (and required containers only, like KafkaResource)
  • These tests will use Indexer as worker as they are faster and lighter than MiddleManagers
  • There will be only a small number of tests that use DruidContainer, some of which will use MiddleManagers

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@kfaraz kfaraz requested review from gianm and kgyrtkirk July 16, 2025 15:21
verifyUsedSegmentCount(10);
}

private KafkaSupervisorSpec createKafkaSupervisor(String supervisorId, String topic)

Check notice

Code scanning / CodeQL

Useless parameter Note test

The parameter 'supervisorId' is never used.
@Akshat-Jain Akshat-Jain reopened this Jul 17, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 17, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 17, 2025
@kfaraz
Copy link
Contributor Author

kfaraz commented Jul 17, 2025

The license check keeps failing. Need to fix up licenses.yml.

for reference:

Error: found 6 missing licenses. These licenses are reported, but missing in the registry
druid_module: druid-testcontainers, groupId: junit, artifactId: junit, version: 4.13.2, license: Eclipse Public License 1.0
druid_module: druid-testcontainers, groupId: org.testcontainers, artifactId: testcontainers, version: 1.21.3, license: None
druid_module: druid-testcontainers, groupId: com.github.docker-java, artifactId: docker-java-api, version: 3.3.4, license: Apache License version 2.0
druid_module: druid-testcontainers, groupId: com.github.docker-java, artifactId: docker-java-transport, version: 3.3.4, license: Apache License version 2.0
druid_module: druid-testcontainers, groupId: com.github.docker-java, artifactId: docker-java-transport-zerodep, version: 3.3.4, license: Apache License version 2.0
druid_module: druid-testcontainers, groupId: org.rnorth.duct-tape, artifactId: duct-tape, version: 1.0.8, license: None

@Akshat-Jain Akshat-Jain reopened this Jul 17, 2025
Assertions.assertEquals(Map.of("id", supervisorId), startSupervisorResult);

// Wait for the broker to discover the realtime segments
broker2.latchableEmitter().waitForEvent(
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why does LatchableEmitter has waitForEvent(UnaryOperator<EventMatcher> condition), it seems like it can just do waitForEvent(EventMatcher matcher)?

Copy link
Contributor Author

@kfaraz kfaraz Jul 18, 2025

Choose a reason for hiding this comment

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

I did have that initially but when I used the lamda, the tests became much more readable. So we kept this syntax.

Copy link
Contributor Author

@kfaraz kfaraz Jul 18, 2025

Choose a reason for hiding this comment

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

The difference is very slight but I preferred the second syntax:

waitForEvent(EventMatcher.matchesA(...).matchesB(...))

and

waitForEvent(event -> event.matchesA().matchesB(...))


private KafkaSupervisorTuningConfig createTuningConfig()
{
return new KafkaSupervisorTuningConfig(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might be more readable if we use a builder, or mapper.readValue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that makes sense. There's another PR that needs to be merged. It has some builders which will be used here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

- name: Run the test
uses: ./.github/workflows/worker.yml
with:
script: .github/scripts/run_unit-tests -Dtest=*DockerTest -Ddruid.testing.docker.image=$DRUID_DIST_IMAGE_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

where is DockerTest defined? is this some kind of smoke test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an IngestionDockerTest that is being newly added in this PR. This command will run future tests also which have the same suffix. But yes, for the most part, it is meant to be a smoke test.

@Akshat-Jain Akshat-Jain reopened this Jul 18, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 18, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 19, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 19, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 19, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 21, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 21, 2025
@Akshat-Jain Akshat-Jain reopened this Jul 21, 2025
@kfaraz
Copy link
Contributor Author

kfaraz commented Jul 21, 2025

Closing in favor of #18302

@kfaraz kfaraz closed this Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants