Skip to content

[tests] Cancellation, composite-provider matrix, HTTP errors, adapter packages #101

@robbyt

Description

@robbyt

Summary

A few coverage gaps surfaced during code review. Bundling them so they can be tackled together (or split into separate PRs per package as appropriate).

Cancellation tests for each engine

PR #81 fixed a Starlark goroutine leak by switching to context.AfterFunc, but no test asserts cancellation actually halts execution within a bounded time. Add:

Race test for concurrent AddDataToContext

Tracked also under #93 (ContextProvider thread-safety). Add go test -race goroutines hammering the same parent context.

CompositeProvider edge-case branches

platform/data/compositeProvider.go:138-146 has two subtle branches — "static-only-and-they-all-error" and "non-static-and-all-fail". Add explicit table cases in compositeProvider_test.go.

HTTP loader error-path tests

platform/script/loader/fromHTTP_test.go doesn't cover:

Adapter package coverage

engines/risor/adapters/interfaces.go and engines/starlark/adapters/interfaces.go have zero *_test.go files. They're intentionally tiny interface stubs, but a build-time var _ Adapter = (*sdk.Whatever)(nil) check would catch SDK-side breaking changes early.

Files

  • engines/{extism,risor,starlark}/evaluator/evaluator_test.go
  • platform/data/contextProvider_test.go
  • platform/data/compositeProvider_test.go
  • platform/script/loader/fromHTTP_test.go
  • engines/risor/adapters/ (new test file)
  • engines/starlark/adapters/ (new test file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions