Testing Providers¶
Four levels of testing, from static checks to live probes.
On this page¶
- Validate the vocabulary
- Test the binary directly
- Write simulation scenarios
- Test against a real system
- Reference implementation
- Next steps
1. Validate the vocabulary¶
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:
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
This tests the vocabulary — are the states, health conditions, and failure modes wired correctly?
4. Test against a real system¶
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 statesmain.go— binary using kubectl JSON outputhooks/install.sh— Go build script referenced frominstall.source.build
The aws provider shows a minimal vocabulary-only provider (no binary).
Next steps¶
- Vocabulary — writing manifest.yaml
- Binary Protocol — implementing probe/validate/describe
- Writing install scripts — build scripts