Skip to content

feat: migrate e2e tests to testcontainers with per-protocol isolation and DAPR_RUNTIME_VER support#748

Draft
Copilot wants to merge 9 commits intomainfrom
copilot/refactor-e2e-tests-to-testcontainers
Draft

feat: migrate e2e tests to testcontainers with per-protocol isolation and DAPR_RUNTIME_VER support#748
Copilot wants to merge 9 commits intomainfrom
copilot/refactor-e2e-tests-to-testcontainers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

  • Resolve merge conflicts with main
  • Fix lint errors, image versioning, disable old e2e workflow triggers, update jest coverage config
  • Create new test-e2e-testcontainers.yml workflow:
    • Triggers on push/PR to main and release branches, plus workflow_dispatch with optional dapr_runtime_ver input
    • No dapr init, no static service containers — testcontainers handles all infrastructure
    • Runs each test group as a separate step (HTTP, gRPC, common, workflow) for clear per-group failure visibility
    • Forwards DAPR_RUNTIME_VER into every test step
    • Verifies TypeScript build via test/e2e/typescript-build
    • Uploads coverage to codecov

Copilot AI and others added 5 commits April 12, 2026 20:25
…ppContainer, containers util)

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/32772c60-2d98-4b75-8ff7-39b1a7c2d611

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
… stacks

Each protocol now uses a completely separate, isolated set of containers:
- 'common/server/http': DaprServer HTTP + DaprContainer (HTTP app protocol)
- 'common/server/grpc': DaprServer gRPC + DaprGrpcAppContainer

The beforeAll startup order follows the requirement:
1. Start Redis + MQTT containers
2. exposeHostPorts for the app server port
3. Register pubsub subscriptions on the DaprServer
4. Start the DaprServer (so Dapr can call the app for subscription registration)
5. Sleep 2s
6. Start the DaprContainer (connects to the running app)

All 30 test cases from the original runIt() pattern are preserved as
plain it() tests in each describe block, with per-block mock state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
…starts

The DaprServer must be created before the DaprContainer (so Dapr can
call the app for subscription registration), but its internal DaprClient
needs the real mapped container ports for publishing in tests.

Fix by replacing the placeholder DaprClient with one pointing to the
actual container host/port after the container starts. Also adds
DaprClient to the imports and removes the unused
buildInMemoryPubSubComponent import.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
…iner isolation and DAPR_RUNTIME_VER support

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/32772c60-2d98-4b75-8ff7-39b1a7c2d611

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
@WhitWaldo
Copy link
Copy Markdown
Contributor

@copilot Can you please resolve the merge conflicts?

…tests-to-testcontainers

# Conflicts:
#	package-lock.json

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 12, 2026

@copilot Can you please resolve the merge conflicts?

Resolved in 07ebf8d. The only conflict was in package-lock.json — several dependency bumps had landed on main (express, path-to-regexp, lodash, js-yaml, form-data). Merged origin/main and regenerated the lock file so both the new @dapr/testcontainer-node entry and all the bumped versions from main are present.

@WhitWaldo
Copy link
Copy Markdown
Contributor

@copilot The placement and scheduler images should always use whatever version is used for the dapr runtime version. Can you please fix the various build errors so build and test pass? As part of this PR, can you please also verify that the whole of your implementation also achieves at least 80% test coverage across the whole of the project and disable the existing test-e2e GitHub action?

…le e2e workflow auto-triggers

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/01fb7fc5-e79d-42fe-a23a-b6c4a8fc713b

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 12, 2026

@copilot The placement and scheduler images should always use whatever version is used for the dapr runtime version. Can you please fix the various build errors so build and test pass? As part of this...

Fixed in bd8d7d8:

  1. Image versioningcontainers.ts now always derives daprd, placement, and scheduler images from the same DAPR_TEST_VERSION (removed the versionOverridden conditional). All three are guaranteed in sync regardless of whether DAPR_RUNTIME_VER is set.

  2. Build errors — removed the three unused DAPR_TEST_*_IMAGE imports from grpc/server.test.ts that were causing lint failures.

  3. test-e2e workflow disabled — removed push, pull_request, and repository_dispatch triggers. The workflow now only runs on workflow_dispatch (manual trigger).

  4. Test coveragejest.config.js updated with collectCoverageFrom: ["src/**/*.ts", "!src/proto/**"] to exclude the generated proto layer and report meaningful numbers. All 252 unit tests pass. Unit-test-only coverage of non-generated source is ~42% (statements). Reaching 80% requires the e2e test suite, since most of the SDK surface (HTTP/gRPC client calls, server callbacks, actors, workflow) can only be exercised against a live Dapr sidecar — which is exactly what the testcontainers-based e2e tests in this PR do.

…ed e2e tests

Agent-Logs-Url: https://github.com/dapr/js-sdk/sessions/b50a3ad7-b1db-4cee-b33f-7bb2857cc22c

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
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