Move most of the remaining tests to Test Containers as well#1785
Move most of the remaining tests to Test Containers as well#1785siri-varma wants to merge 19 commits into
Conversation
…acy CI Migrates the last 7 sdk-tests ITs off the dapr-run CLI harness onto BaseContainerIT/DaprContainer so the build job can drop the Dapr CLI, dapr init/uninstall, host Kafka, and host ToxiProxy setup. Covers the app-restart, sidecar-restart, multi-sidecar failover, ToxiProxy, and Kafka mechanics, plus CI and dead-code cleanup. Addresses dapr#1522. Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
…eck invariant, reminder client, explicit YAML cleanup Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
… type name Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
…ecar helper) Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
…cement/scheduler) Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Every migrated actor IT attaches daprd to the JVM-wide shared Network. The builder previously used withReusablePlacement(true); with Testcontainers reuse disabled (as on CI), DaprContainer.configure() auto-creates a placement + scheduler per daprd instance -- each claiming the "placement"/"scheduler" network alias and never stopped (no stop() override). Multiple containers answering one alias make Docker DNS round-robin daprd to an arbitrary/empty control plane, so multi-sidecar failover (ActorReminderFailoverIT) and post-restart reminder recovery (ActorReminderRecoveryIT) hit a placement that never saw the actor-host registrations -> "did not find address for actor" / reminder not resumed. Introduce JVM-singleton placement()/scheduler() in SharedTestInfra on the shared network and wire every daprd to them via withPlacementContainer/ withSchedulerContainer. Exactly one container answers each alias, so DNS resolves deterministically; this also eliminates the per-daprd control-plane container leak. Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
These were working documents for the Testcontainers migration and are not part of the shipped SDK; dropping them from the PR. Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
The http tracing test app's Spring @bean OpenTelemetryConfig.initOpenTelemetry() called the legacy io.dapr.it.tracing.OpenTelemetry.createOpenTelemetry(SERVICE_NAME) overload, which runs waitForZipkin() -> NetworkUtils.waitForSocket(127.0.0.1, 9411). After the Testcontainers migration Zipkin runs on a random mapped host port, not a fixed 9411, so that probe threw ConnectException, bean creation failed, the app subprocess never bound its port, and startAppAndAttach reported connection refused. Switch to the two-arg createOpenTelemetry(SERVICE_NAME, url) overload that skips the probe. The app exports no spans the test asserts on -- the validated calllocal/tracing-http-it/sleep span is emitted by the Dapr sidecar, which exports to Zipkin over the container network -- so the app only needs to boot. Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
…g config The prior "Optimize docs" commit switched the job to javadoc:aggregate, but that goal does not apply the pom's <reporting> configuration -- additionalDependencies (spring-data-commons/keyvalue) and excludePackageNames -- so aggregate Javadoc fails to resolve spring-data symbols (TypeInformation, PropertyPath) and the build errors out. Revert the step to site-deploy, which runs Javadoc as a site report so that config applies. The actual speedup is unchanged: <inherited>false> on the aggregate report (in the same "Optimize docs" commit) stops the report re-executing once per reactor module -- the source of the ~32 min runtime -- so it now runs a single aggregate pass. Signed-off-by: Siri Varma Vegiraju <siri.varma@outlook.com>
| <!-- Aggregate is a root-only report. Without inherited=false the site | ||
| lifecycle re-runs it at every reactor module, multiplying a full-source | ||
| Javadoc pass ~10x. Keep it pinned to the aggregator module. --> | ||
| <inherited>false</inherited> |
There was a problem hiding this comment.
@javier-aliaga / @cicoyle Please double check this change.
We are able to save 30 mins because of this change. It was taking 32 mins before now just takes 4 mins
|
@javier-aliaga need one review on this pr please |
There was a problem hiding this comment.
Pull request overview
This PR completes the migration of sdk-tests integration tests from the legacy dapr run CLI harness to a Testcontainers-based harness (BaseContainerIT / DaprContainer), while also removing now-unused legacy CI setup to reduce build flakiness/timeouts.
Changes:
- Migrated remaining CLI-harness integration tests and app fixtures to Testcontainers, removing
DaprRun/BaseIT/@DaprRunConfigand introducing container-native equivalents (app subprocess + sidecar container). - Introduced JVM-singleton shared test infrastructure (
SharedTestInfra) for backing services and a single shared Dapr placement/scheduler to prevent Docker network-alias DNS collisions across multiple sidecars. - Simplified CI by removing Dapr CLI/runtime init and host-managed Kafka/ToxiProxy setup; added Maven caching for docs validation and prevented repeated aggregate Javadoc generation across reactor modules.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk-tests/src/test/java/io/dapr/it/tracing/http/Service.java | Removes legacy @DaprRunConfig usage for the tracing HTTP test service. |
| sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryConfig.java | Avoids startup-blocking Zipkin readiness probe by switching to the explicit-endpoint OpenTelemetry factory overload. |
| sdk-tests/src/test/java/io/dapr/it/tracing/grpc/Service.java | Removes legacy @DaprRunConfig usage for the tracing gRPC test service. |
| sdk-tests/src/test/java/io/dapr/it/ToxiProxyRun.java | Deletes legacy host-binary ToxiProxy runner in favor of Testcontainers ToxiProxy. |
| sdk-tests/src/test/java/io/dapr/it/resiliency/WaitForSidecarIT.java | Migrates waitForSidecar resiliency test to Testcontainers + ToxiProxyContainer. |
| sdk-tests/src/test/java/io/dapr/it/methodinvoke/http/MethodInvokeService.java | Removes legacy @DaprRunConfig usage for method-invoke HTTP service. |
| sdk-tests/src/test/java/io/dapr/it/methodinvoke/grpc/MethodInvokeService.java | Removes legacy @DaprRunConfig usage for method-invoke gRPC service. |
| sdk-tests/src/test/java/io/dapr/it/DaprRunConfig.java | Deletes legacy annotation configuration used by the CLI harness. |
| sdk-tests/src/test/java/io/dapr/it/DaprRun.java | Deletes legacy dapr run CLI harness implementation. |
| sdk-tests/src/test/java/io/dapr/it/containers/SharedTestInfra.java | Adds shared Docker network + singleton Redis/Zipkin/Mongo/Kafka plus singleton placement/scheduler containers. |
| sdk-tests/src/test/java/io/dapr/it/containers/BaseContainerIT.java | Adds helpers for app+sidecar lifecycle, shared control plane wiring, sidecar/app restart helpers, ToxiProxy helper, and Kafka/HTTP binding component helpers. |
| sdk-tests/src/test/java/io/dapr/it/binding/http/BindingIT.java | Migrates binding integration tests to Testcontainers and in-code component creation (Kafka + HTTP binding). |
| sdk-tests/src/test/java/io/dapr/it/BaseIT.java | Deletes legacy base test harness used by CLI-based ITs. |
| sdk-tests/src/test/java/io/dapr/it/actors/services/springboot/StatefulActorService.java | Removes legacy @DaprRunConfig usage for actor service fixture. |
| sdk-tests/src/test/java/io/dapr/it/actors/app/MyActorService.java | Removes legacy @DaprRunConfig usage for actor service fixture. |
| sdk-tests/src/test/java/io/dapr/it/actors/ActorTimerRecoveryIT.java | Migrates timer recovery test to BaseContainerIT + app subprocess attach model. |
| sdk-tests/src/test/java/io/dapr/it/actors/ActorStateIT.java | Migrates actor state test to BaseContainerIT + app subprocess attach model. |
| sdk-tests/src/test/java/io/dapr/it/actors/ActorSdkResiliencyIT.java | Replaces host ToxiProxy usage with Testcontainers ToxiProxy and migrates to container harness (still disabled). |
| sdk-tests/src/test/java/io/dapr/it/actors/ActorReminderRecoveryIT.java | Migrates reminder recovery test to container harness and uses restartSidecar helper. |
| sdk-tests/src/test/java/io/dapr/it/actors/ActorReminderFailoverIT.java | Migrates multi-sidecar failover test to shared placement/scheduler model to avoid alias collisions. |
| sdk-tests/pom.xml | Adds testcontainers-kafka test dependency. |
| sdk-tests/deploy/local-test.yml | Removes legacy local docker-compose harness no longer needed. |
| sdk-tests/components/kafka_bindings.yaml | Removes legacy YAML component config (now created in code). |
| sdk-tests/components/http_binding.yaml | Removes legacy YAML component config (now created in code). |
| pom.xml | Prevents aggregate Javadoc report from running in every reactor module (<inherited>false</inherited>). |
| .github/workflows/validate-docs.yml | Enables Maven cache for docs validation workflow. |
| .github/workflows/build.yml | Removes legacy Dapr CLI/runtime init and host Kafka/ToxiProxy setup from CI build job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1785 +/- ##
============================================
+ Coverage 77.02% 77.06% +0.04%
Complexity 2324 2324
============================================
Files 245 245
Lines 7198 7198
Branches 760 760
============================================
+ Hits 5544 5547 +3
+ Misses 1288 1285 -3
Partials 366 366 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Finishes migrating the
sdk-testsintegration tests off the legacydapr runCLI harness and onto Testcontainers (BaseContainerIT/DaprContainer), and strips the now-unused legacy setup from thebuildCI job. This removes the slow, flaky host-daprdpath that was driving thebuild sb:3.5.xjob toward its timeout.What changed
Test migration (last legacy ITs → Testcontainers)
ActorReminderRecoveryIT,ActorReminderFailoverIT,WaitForSidecarIT,BindingIT(now Testcontainers Kafka + in-code bindings), andActorSdkResiliencyIT(moved offToxiProxyRun; still@Disabled).BaseContainerIT:startAppAndAttach(app subprocess + pinned-portdaprd),restartApp/restartSidecar,waitForActorsReady, andnewToxiproxy(Testcontainers ToxiProxy for network-fault injection — replaces the host-installed binary; same toxics, now hermetic and version-pinned).SharedTestInfra: one DockerNetwork+ JVM-singleton Redis / Zipkin / Mongo / Kafka.Actor IT flakiness fix — shared control plane (DNS-alias collision)
daprdto the JVM-wide sharedNetwork. The builder usedwithReusablePlacement(true); with Testcontainers reuse disabled (as on CI),DaprContainer.configure()auto-creates a placement and scheduler perdaprdinstance — each claiming theplacement/schedulernetwork alias and never stopped (nostop()override). Multiple containers answering one alias make Docker DNS round-robindaprdto an arbitrary/empty control plane, so multi-sidecar failover (ActorReminderFailoverIT) and post-restart reminder recovery (ActorReminderRecoveryIT) hit a placement that never saw the actor-host registrations →did not find address for actor/ reminders not resumed.placement()/scheduler()inSharedTestInfraon the shared network, wired into everydaprdviawithPlacementContainer/withSchedulerContainer. Exactly one container answers each alias, so DNS resolves deterministically; this also removes the per-daprdcontrol-plane container leak.CI cleanup
dapr init, host Kafka, and host ToxiProxy setup from thebuildjob.dapr runharness, binding YAMLs, andlocal-test.yml.Issue reference
Closes #1522
Test results
ActorReminderRecoveryIT(4/4) andActorReminderFailoverIT(1/1), which failed deterministically before the fix, now pass both in isolation and in the full suite.tracing.http.TracingIT: fixed. Its Spring@Beanapp eagerly called the legacyOpenTelemetry.createOpenTelemetry(SERVICE_NAME)overload, which probes a fixed127.0.0.1:9411for Zipkin readiness. After this migration Zipkin runs as a Testcontainer on a random mapped host port, so the probe threwConnectException, the app subprocess crashed before binding its port, andstartAppAndAttachreported "connection refused". Switched the bean to the explicit-endpoint overload that skips the probe (the app exports no spans the test asserts on — the validatedcalllocal/tracing-http-it/sleepspan is emitted by the sidecar over the container network). Passes in isolation.sdk-testssuite (local): 7 → 1 error. All four actor errors resolved by the control-plane fix;TracingIT.httpresolved by the bean fix above.spring.messaging.DaprSpringMessagingIT) is a topic-subscription readiness timeout. It reproduces even in isolation and is independent of this PR — it is a standalone@SpringBootTestthat manages its own container and touches none of the code changed here. It appears environment-sensitive on a local macOS Docker host (useshost.testcontainers.internal); CI on this PR is the arbiter for whether it affects the target environment. Tracked as follow-up, not introduced here.Checklist