bolt
bolt copied to clipboard
Unit tests/spec: Invalid inventoryfile structure can cause hard to debug error
Describe the Bug
Same as #2430 but for unit tests. Accidentally loaded an inventory yaml file without a groups key:
- name: somegroup
targets:
- alias: somealias
name: somename
uri: some.uri
running a unit test using it returns
... instead of raising Puppet::PreformattedError(Evaluation Error: Error while evaluating a Function Call, undefined method `key?' for [{"name"=>"somegroup", "targets"=>[{"alias"=>"somealias", "name"=>"somename", "uri"=>"some.uri"}]}]:Array
Expected Behavior
Print a clear error that the inventory structure is invalid