Skip to content

[Task][Plugin] Provide an externally consumable reactive plugin contract test kit #8202

Closed
apache/shenyu-plugin-store
#34

Description

@Aias00

Goal and boundary

Provide a reusable test-scope plugin contract kit that an out-of-tree Java plugin can consume to verify its reactive behavior against ShenYu's existing LEGACY executor. Extract and organize existing regression tests and real runtime fixtures rather than creating another mock chain or changing ShenyuPlugin semantics.

This task owns the reusable fixture/package, role-aware assertions, example consumer and contribution guide. #7294 remains the owner of plugin-store build/release infrastructure, published API/BOM compatibility matrices and cross-repository E2E workflows; #7306 remains the migration tracker. This is not another SDK/release program and does not depend on implementing graph execution.

Verified starting point

Reviewed master 750673e3f619e335333150ff1b2d14070d5d5c31:

The gap is independently consumable, common behavioral evidence for a plugin author; it is not a claim that plugins currently have no tests.

First delivery

  1. Package existing useful fixtures and assertions. Add a focused test-support artifact, a documented supported dependency surface and a minimal out-of-tree example. It must not add runtime dependencies to plugins or require their production artifacts to depend on test infrastructure. Reuse the actual legacy runtime where chain integration is tested.
  2. Make tests role-aware. Provide a common lifecycle/diagnostic layer and opt-in profiles for pass-through/transform plugins, short-circuit or response-owner plugins, downstream wrappers, and AbstractShenyuPlugin selector/rule matching. Internal-dispatch/fork tests apply only where that capability is used. A wrapper that legitimately decorates or resubscribes downstream must not fail a blanket “continuation exactly once” assertion.
  3. Cover observable reactive contracts. Exercise side effects at the actual handler/root subscription boundary, completion/error/cancellation propagation, skip and rule misses, response ownership/decorators, wrapper nesting and resource release hooks. Keep the current construction-time before/after behavior. Do not forbid all side effects during a direct execute() call: the real handler defers invocation to root subscription, and the kit must test that documented boundary rather than invent a new assembly-purity rule. Add configuration update/remove fixtures for plugins that declare a data handler; resources/leases are tested only against contracts that actually exist.
  4. Explain what each check proves. Record test-kit version, core revision/version, selected profiles and skipped/unsupported capabilities. Keep protocol/SDK-specific correctness and real external-system E2E in the owning plugin repository. Future GRAPH parity can reuse fixtures, but must not change LEGACY expectations in this task.

Acceptance criteria

  • An example outside the main source reactor builds and runs the packaged test support against its declared core/API dependencies. A producer packaging step plus a fixed staging repository is acceptable for development verification; a local reactor shortcut is not the only evidence.
  • At least two distinct existing roles are demonstrated: a transformation plugin and a downstream wrapper/short-circuit fixture. Their expected downstream invocation patterns are explicit, rather than guessed from numeric order.
  • Tests detect representative bad fixtures: effects before the root handler publisher is subscribed, lost cancellation/cleanup, unexpected duplicate side effects for a declared role, broken decorator propagation and stale state after an explicitly supported configuration removal.
  • Tests use controlled signals/time and avoid sleeps, nondeterministic traffic percentages or coverage-count targets. Failure output names the plugin, contract/profile and expected signal or state.
  • Real runtime integration covers skip/miss, normal completion, failure, cancellation, repeated subscriptions and optional isolated fork behavior without copying the legacy cursor implementation into the test package.
  • Ordinary unit-contract runs need no Docker or shared credentials. One opt-in real-gateway smoke/example reuses the existing integration-test machinery; [Task] Establish the shenyu-plugin-store build, test, E2E, and release baseline #7294 consumes it for store CI rather than this task replacing that workflow.
  • Contribution documentation explains role selection, legacy limitations, descriptor-free plugin compatibility and how a third-party repository adds the kit. No mandatory new plugin interface, cache() insertion or execution-path change is introduced.

Coordination

Tracking

Plugin-system tracker: #8199.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions