Skip to main content
The Go test integration is the varianztest package in the SDK module — no separate install:
vt.NewSession(t, endpoint) registers cleanup with t — stages are removed and the session destroyed when the test ends. Run go test with the standard environment (VARIANZ_ENABLED=true, and VARIANZ_INSECURE_ALLOW_PLAINTEXT=true for a plaintext local coordinator).
Initialise the SDK in the test binary, and run go test -v.go test never runs main(), so when the VPoints live in the test process nothing connects them to the coordinator unless you call vz.Init() yourself — normally from TestMain:
Without it every stage is inert and the only notice is a teardown warning. That warning, and every other Varianz diagnostic, goes to the test log, which go test discards for a passing package. The lines worth grepping for:
  • No subscribers received the N staged instruction(s) — the service process never connected.
  • failed to compile; it was NOT attached and will not run — the stage is inert.
  • executed with active stages but no session id — the session did not reach the call context.

Stage examples

Field names in args follow the Go SDK’s field-naming rules — BasePrice is args.base_price unless tagged otherwise.

Session API

Sample assertions

HasValue takes a dot path into the sampled value ("" for the value itself); Samples() on the assertion returns the collected raw samples when you need custom checks.

In-process calls

When the code under test is in the same process, put the session on the context instead of a header: