docs/local-cre/system-tests/workflows-in-tests.md
The smoke tests should usually use the shared helpers rather than re-implementing workflow compilation, artifact copying, and registration.
Prefer:
t_helpers.CompileAndDeployWorkflow(...)
That helper:
Use WithArtifactCopyDONTypes(...) when a test intentionally needs artifact copy to additional DON types.
The more important authoring choice is usually not workflow compilation. It is which environment helper the test uses.
Use:
t_helpers.SetupTestEnvironmentWithPerTestKeys(...)
for workflow-plane tests that may run in parallel or perform independent on-chain writes. This path:
Use:
t_helpers.SetupTestEnvironmentWithConfig(...)
for admin, control-plane, or ownership-sensitive tests that must use the shared root signer. This is the safer choice for flows such as:
As a rule:
SetupTestEnvironmentWithPerTestKeys(...) for v2 workflow execution testsSetupTestEnvironmentWithConfig(...) only when the test needs shared owner privileges or intentionally avoids per-test signer isolationThe shared compiler in system-tests/lib/cre/workflow/compile.go applies these rules:
go mod tidy before buildCGO_ENABLED=0, GOOS=wasip1, and GOARCH=wasmbun cre-compile.br.b64Workflow config files are optional and specific to the workflow under test.
Secrets support is provided by the shared workflow package, which prepares encrypted secrets for registration against the current DON and capabilities registry.
This area also includes:
Keep those patterns only for tests that truly need lower-level control. The standard smoke path should still prefer CompileAndDeployWorkflow.
The PoR-related tests use a shared PriceProvider abstraction with two main implementations:
TrueUSDPriceProviderFakePriceProviderTrueUSDPriceProvider uses the live TrueUSD reserve endpoint and mainly validates that prices become non-zero.
FakePriceProvider starts a shared fake HTTP server once, generates a bounded sequence of test prices for each feed, enforces auth headers, and tracks both expected and actual prices for stricter assertions.
Use the fake provider for local and repeatable smoke coverage. Use the live provider only when a scenario intentionally validates the integration path against live data.