Skip to content

Move most of the remaining tests to Test Containers as well#1785

Open
siri-varma wants to merge 19 commits into
dapr:masterfrom
siri-varma:users/svegiraju/finish-testcontainers-migration
Open

Move most of the remaining tests to Test Containers as well#1785
siri-varma wants to merge 19 commits into
dapr:masterfrom
siri-varma:users/svegiraju/finish-testcontainers-migration

Conversation

@siri-varma

@siri-varma siri-varma commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Finishes migrating the sdk-tests integration tests off the legacy dapr run CLI harness and onto Testcontainers (BaseContainerIT / DaprContainer), and strips the now-unused legacy setup from the build CI job. This removes the slow, flaky host-daprd path that was driving the build sb:3.5.x job toward its timeout.

What changed

Test migration (last legacy ITs → Testcontainers)

  • Migrated the remaining CLI-based ITs: ActorReminderRecoveryIT, ActorReminderFailoverIT, WaitForSidecarIT, BindingIT (now Testcontainers Kafka + in-code bindings), and ActorSdkResiliencyIT (moved off ToxiProxyRun; still @Disabled).
  • Added reusable mechanics to BaseContainerIT: startAppAndAttach (app subprocess + pinned-port daprd), restartApp / restartSidecar, waitForActorsReady, and newToxiproxy (Testcontainers ToxiProxy for network-fault injection — replaces the host-installed binary; same toxics, now hermetic and version-pinned).
  • Centralized shared backing services in SharedTestInfra: one Docker Network + JVM-singleton Redis / Zipkin / Mongo / Kafka.

Actor IT flakiness fix — shared control plane (DNS-alias collision)

  • Root cause: every actor IT attaches daprd to the JVM-wide shared Network. The builder used withReusablePlacement(true); with Testcontainers reuse disabled (as on CI), DaprContainer.configure() auto-creates a placement and 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 / reminders not resumed.
  • Fix: JVM-singleton placement() / scheduler() in SharedTestInfra on the shared network, wired into every daprd via withPlacementContainer / withSchedulerContainer. Exactly one container answers each alias, so DNS resolves deterministically; this also removes the per-daprd control-plane container leak.

CI cleanup

  • Dropped Dapr CLI + dapr init, host Kafka, and host ToxiProxy setup from the build job.
  • Removed the dead dapr run harness, binding YAMLs, and local-test.yml.

Issue reference

Closes #1522

Test results

  • Actor package: greenActorReminderRecoveryIT (4/4) and ActorReminderFailoverIT (1/1), which failed deterministically before the fix, now pass both in isolation and in the full suite.
  • tracing.http.TracingIT: fixed. Its Spring @Bean app eagerly called the legacy OpenTelemetry.createOpenTelemetry(SERVICE_NAME) overload, which probes a fixed 127.0.0.1:9411 for Zipkin readiness. After this migration Zipkin runs as a Testcontainer on a random mapped host port, so the probe threw ConnectException, the app subprocess crashed before binding its port, and startAppAndAttach reported "connection refused". Switched the bean to the explicit-endpoint 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 sidecar over the container network). Passes in isolation.
  • Full sdk-tests suite (local): 7 → 1 error. All four actor errors resolved by the control-plane fix; TracingIT.http resolved by the bean fix above.
  • 1 remaining local failure (spring.messaging.DaprSpringMessagingIT) is a topic-subscription readiness timeout. It reproduces even in isolation and is independent of this PR — it is a standalone @SpringBootTest that manages its own container and touches none of the code changed here. It appears environment-sensitive on a local macOS Docker host (uses host.testcontainers.internal); CI on this PR is the arbiter for whether it affects the target environment. Tracked as follow-up, not introduced here.

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

siri-varma added 14 commits July 9, 2026 17:08
…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>
@siri-varma siri-varma requested review from a team as code owners July 10, 2026 04:39
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>
@siri-varma siri-varma changed the title Make Integration Tests Faster Move most of the remaining tests to Test Containers as well Jul 10, 2026
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>
Comment thread pom.xml
<!-- 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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.06%. Comparing base (26b2327) to head (c7fdb76).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@siri-varma

Copy link
Copy Markdown
Contributor Author

@javier-aliaga need one review on this pr please

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.

Optimize CI/CD build times - Integration tests timing

1 participant