Skip to content

CLI: gonext plugin test (in-process fake host + contract conformance suite) #247

@tayebmokni

Description

@tayebmokni

Summary

Implement gonext plugin test — the contract test runner. Loads the plugins WASM in-process against a fake host (in-memory KV, pgmock Postgres, recorded HTTP), runs the plugin authors tests. Lets plugin authors get end-to-end-ish testing without docker.

Shipped as a Go library sdk-go/wptest plus a CLI wrapper.

Design reference

  • docs/02-plugin-system.md §11.4

Acceptance criteria

  • Package github.com/gonext/sdk-go/wptest with wptest.NewHost(t) returning an in-process fake host
  • Fake host implements the FULL host ABI surface: db (in-memory or pgmock), kv (in-memory), http (recorded responses fixture file), email (captured to a slice), media (in-memory), users (test fixture), secrets (test fixture), audit (collected to a slice), cron (manually fire-able)
  • h.LoadPlugin(path) error instantiates the WASM via wazero with the test host
  • h.ApplyFilter(name, value, args...), h.DoAction(name, args...): drives the hook bus
  • h.GetRoute(path), h.PostRoute(path, body): drives plugin REST routes
  • h.FireCron(name): manually fires a declared cron job
  • h.SetSecret(plugin, key, val): pre-populates test secrets
  • h.AssertAuditEmitted(event, matcher): assertion helper for audit events
  • gonext plugin test [dir] CLI: runs the plugin authors tests (go test ./... for Go plugins, cargo test for Rust, npm test for TS), all using the same fake host
  • Contract conformance suite: a shared set of "every plugin must pass these" tests (e.g., manifest validates, all declared exports exist, no banned imports, msgpack round-trips)
  • Tests: the SEO sample plugin passes the conformance suite end-to-end

Dependencies

#237/#239/#242 (SDKs), pgmock integration

Complexity

L

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliwpclone CLIarea:plugin-sdkPlugin SDK (Go/Rust/TS)phase:P4-pluginsPhase 4 — Pluginspriority:P1Important — should land in phaseskill:goGo programmingtype:featNew feature or implementation task

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions