Portals.Conformance.WorkerSuite (portals v0.1.0)

Copy Markdown View Source

The shared black-box integration suite every worker SDK must pass.

Every supported language is held to the same expectations: unary calls, structured errors, out-of-order concurrency, crash propagation, callbacks, PID messaging, cancellation, bidirectional streaming with backpressure, and pooling. The assertions live here once; a language package's test module supplies only how to launch a worker built from the fixture modules (bench_worker, conformance_worker) that every SDK ships:

defmodule PortalsRuby.WorkerSuiteTest do
  use Portals.Conformance.WorkerSuite,
    worker: Portals.Ruby.worker_opts(script: "priv/ruby/test/fixtures/run_worker.rb")
end

:worker is evaluated when the test module compiles and must be a keyword list accepted by Portals.start_worker/1. Options a test adds (:limits, :env) are merged on top, with :env entries appended. :moduletag adds module tags to every test in the suite, e.g. moduletag: [runtime: :deno] to include or exclude one runtime's run.

The suite needs ExUnit, so it is only usable from tests. A new language adapter can use it the same way: see the adapter guide.