Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests/spec: Invalid inventoryfile structure can cause hard to debug error #3345

Open
dionysius opened this issue Sep 6, 2024 · 0 comments
Labels
Bug Bug reports and fixes.

Comments

@dionysius
Copy link

dionysius commented Sep 6, 2024

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

@dionysius dionysius added the Bug Bug reports and fixes. label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug reports and fixes.
Projects
None yet
Development

No branches or pull requests

1 participant