Skip to content

Testing

  • tntc CLI installed
  • Deno runtime for engine tests
  • Go 1.22+ for Go tests (if contributing to Tentacular itself)

The primary way to test tentacles:

Terminal window
tntc test # all node fixtures
tntc test my-tentacle/fetch-data # single node
tntc test --pipeline # full DAG end-to-end

Each node needs a fixture at tests/fixtures/<node-name>.json:

{
"input": { "query": "test" },
"expected": { "results": [] }
}

For nodes that use config or secrets, include those in the fixture:

{
"input": { "alert": true },
"config": { "endpoints": ["https://example.com"] },
"secrets": { "slack": { "webhook_url": "https://hooks.slack.com/test" } },
"expected": { "delivered": false }
}
FieldTypeRequiredDescription
inputanyYesValue passed as input to the node function
configRecord<string, unknown>NoInjected as ctx.config
secretsRecord<string, Record<string, string>>NoInjected as ctx.secrets
expectedanyNoExpected return value (JSON deep equality)

The engine provides a mock context (engine/testing/mocks.ts) that:

  • Stubs ctx.dependency() with mock secret values
  • Records dependency access for drift detection
  • Returns { mock: true, dependency, path } from HTTPS mock fetch()
  • Provides ctx.log that captures output

tntc test --pipeline runs the full DAG end-to-end using fixture chain:

  1. Root nodes receive their fixture input
  2. Each node’s output feeds into downstream nodes
  3. Leaf node output is compared against its expected
  1. Create fixtures for each node in tests/fixtures/
  2. Run tntc test to validate individual nodes
  3. Run tntc test --pipeline to validate the full DAG
  4. Fix any assertion failures — check node logic and fixture expectations

If contributing to the Tentacular engine itself:

Terminal window
cd engine && deno test --allow-read --allow-write=/tmp --allow-net --allow-env
ModuleTestsCoverage
compiler9DAG compilation: chains, fan-out, fan-in, cycles
context12Context: fetch, auth injection, logging, config
secrets6Secret loading: YAML, directory, cascade
cascade7Cascade: precedence, merging, fallback
executor7Execution: chains, parallel, retry, timeout
nats7NATS: options validation, triggers

If contributing to the tntc CLI:

Terminal window
go test ./pkg/...
PackageTestsCoverage
pkg/spec17Parser: valid spec, naming, cycles, edges, triggers
pkg/builder38K8s manifests: security, probes, RuntimeClass, NetworkPolicy
pkg/cli42Secret provisioning, config loading, secrets check/init
pkg/k8s3Preflight checks
  • All tntc test fixtures pass with no errors
  • Pipeline test runs the full DAG successfully
  • No auth errors in logs when running with mock context
  • Deployed tentacles return expected results via tntc run
SymptomCauseFix
fixture not foundMissing test fixtureCreate tests/fixtures/<node-name>.json
expected X but got YNode logic or fixture mismatchCheck node implementation and fixture expected value
dependency not foundNode uses undeclared dependencyAdd dependency to contract in workflow.yaml
Pipeline test hangsNode timeoutCheck config.timeout value or add timeout to fixture