The protocol conformance suite every worker SDK must pass.
Portals.Conformance.Runner checks a codec directly. A foreign SDK cannot
be handed to it as a module, so this suite drives it over a
language-neutral bridge instead: every SDK ships a conformance_worker
fixture whose echo_term round-trips a term through the SDK's own codec
and whose decode_reason classifies raw bytes. The golden vectors
(protocol/vectors/golden.exs) and malformed fixtures
(protocol/malformed/fixtures.exs) are replayed against it from the same
source of truth the Elixir codec is checked against, so every SDK
classifies every fixture identically.
defmodule PortalsRuby.ConformanceTest do
use Portals.Conformance.SDKSuite,
language: "ruby",
worker: Portals.Ruby.worker_opts(script: "priv/ruby/test/fixtures/run_worker.rb"),
stdio_worker:
Portals.Ruby.worker_opts(script: "priv/ruby/test/fixtures/run_worker_stdio.rb"),
bad_version_worker:
Portals.Ruby.worker_opts(
script: "priv/ruby/test/fixtures/run_worker.rb",
env: [{"PORTALS_PROTOCOL_VERSION", "999"}]
)
endOptions
:language(required) — used in test names.:worker(required) —Portals.start_worker/1options for a worker that serves theconformance_workerandbench_workerfixtures over the default Unix-socket transport.:stdio_worker(required) — the same, for a worker using the framed stdio fallback transport. The suite addstransport: :stdio.:bad_version_worker(required) — a worker that advertises protocol version 999 in itsHELLO.:moduletag— extra module tags for every test in the suite, e.g.[runtime: :deno].
The suite also asserts that the SDK reports the same version as the
portals application, since every SDK is released in lockstep with it.
Summary
Functions
The decode_reason every SDK must report for each malformed fixture.