Skip to content

testsuite: run worker plugins in the test environments #2480

Description

@DABH

Problem

Worker plugins (worker.Options.Plugins) do not apply in the test environments: TestWorkflowEnvironment / TestActivityEnvironment never construct a real worker, so no plugin hook (ConfigureWorker, StartWorker/RunContextBefore, StopWorker/RunContextAfter) ever runs. Anything a plugin contributes — registered workflows/activities, interceptors, converters — must be wired manually in tests.

This splits integration packaging in two: e.g. contrib/googleadk ships NewPlugin as its standard wiring (#2478), but tests must fall back to NewActivities + Register, and that manual path has to stay public (and documented) solely for testability. sdk-python does not have this gap — its test environment runs a real worker, so plugins compose into tests transparently.

Proposal

Let the test environments accept plugins (e.g. honor SetWorkerOptions(worker.Options{Plugins: ...}) or a dedicated setter) and invoke at minimum ConfigureWorker plus the StartWorker/StopWorker run-context hooks around test execution, with the environment's registry backing the plugin registry. That would let a plugin be the single wiring surface for an integration, in production and tests alike — and would unblock deprecating integration-specific manual registration APIs (see discussion on #2478).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions