Repository navigation
Closed
Labels
priority: highHigh prioritystatus: blockedSomething prevents progresstype: featureNew feature or requesttype: testingRelated to code testingworkload: daysLikely takes days to resolve
Milestone
Description
Problem
Plugin authors (monorepo foca-plugins, third parties) need to test
their plugins without an app, database or network, and the monorepo CI
needs one contract that every plugin must meet.
Proposal
foca.plugins.testing (framework-free):
PluginHarness(PluginClass, config=..., api="tes", validate=...):
runs single hooks or whole pipelines through the real engine.- Builders:
make_principal,make_inbound(payload, ...),
make_backend(id, url, labels=...),make_outbound(...),
make_response(...). FakeHttp: a stand-in forctx.httpthat records calls, returns
canned responses and enforces the deadline.- Contract checks
check_plugin_contract(PluginClass, ...)(also as a
pytest plugin module): entry point loads; metadata complete (apis,
phases,capabilitiesdescriptors valid,maturity,
api_version);Config/Paramsexport JSON Schema; hooks don't touch
ctx.original; failed hooks leave the input unchanged; route returns
a subset;record()within limits; no framework imports; concurrency
smoke test (one instance, 20 threads). - Entry-point fixture for app tests: a pytest fixture (e.g.
fake_plugin_entry_points) that registers fake plugins as entry points
of groupfoca.pluginsby patching the loader's entry-point lookup,
so apps (proTES) test the real allowlist path without a test-only
distribution; production code has no bypass. - Plugin author guide (docs): writing, registering, testing,
releasing a plugin; rules (thread safety,ctx.state, no personal
data inrecord(), descriptors).
Acceptance criteria
- The kit tests FOCA's own
foca.routing.orderedand example plugins
in FOCA's test suite. - Contract failures give actionable messages.
- The entry-point fixture is used by FOCA's own engine tests and
restores the lookup afterwards. - 100% coverage, mypy, ruff,
mkdocs build --strict.
Surviving the Connexion 3 migration
No framework objects (does not need H1-S draft D's foca.testing, which
moved to v0.19.0). With P8 the harness also awaits async def hooks;
existing tests keep working.
Dependencies
- Blocked by feat(plugins): add plugin engine #486 (P1); stacked on feat(plugins): list available plugins #489.
Open questions
- None.
Metadata
Metadata
Assignees
Labels
priority: highHigh prioritystatus: blockedSomething prevents progresstype: featureNew feature or requesttype: testingRelated to code testingworkload: daysLikely takes days to resolve
Activity
test(plugins): use URL invalid in all requests
fix(plugins): align test kit with the real client