Skip to content

Testing Providers

Four levels of testing, from static checks to live probes.

On this page

  1. Validate the vocabulary
  2. Test the binary directly
  3. Write simulation scenarios
  4. Test against a real system
  5. Reference implementation
  6. Next steps

1. Validate the vocabulary

mgtt provider validate ./my-provider

Checks: YAML syntax, state ordering, fact types resolve against stdlib, failure_modes reference declared states, expressions parse correctly.

2. Test the binary directly

./bin/mgtt-provider-my-provider validate --namespace production
./bin/mgtt-provider-my-provider probe myserver connected --namespace production --type server

Expected output:

{"ok": true, "auth": "config loaded", "access": "read-only"}
{"value": true, "raw": "true"}

3. Write simulation scenarios

Create scenarios that inject facts from your provider's types and assert the engine reasons correctly:

# scenarios/server-down.yaml
name: server unreachable
inject:
  myserver:
    connected: false
expect:
  root_cause: myserver
mgtt simulate --scenario scenarios/server-down.yaml

This tests the vocabulary — are the states, health conditions, and failure modes wired correctly?

4. Test against a real system

mgtt provider install ./my-provider
mgtt plan --component myserver

This tests the binary — does it actually collect facts from a live system?


Reference implementation

The kubernetes provider is the reference implementation:

  • manifest.yaml — full vocabulary with 2 types, 5 facts, 4 states
  • main.go — binary using kubectl JSON output
  • hooks/install.sh — Go build script referenced from install.source.build

The aws provider shows a minimal vocabulary-only provider (no binary).


Next steps