ansible-collections / community.hashi_vault

Ansible collection for managing and working with HashiCorp Vault.
https://docs.ansible.com/ansible/devel/collections/community/hashi_vault/index.html
GNU General Public License v3.0
80 stars 59 forks source link

add tests for modules being included in the action group #252

Open briantist opened 2 years ago

briantist commented 2 years ago
SUMMARY

I was thinking about how to prevent #251 in the future, and maybe trying to add tests for modules to ensure that they are in the action group. They would have to run only on core-2.12 and higher, was thinking I could set defaults for the group, then run the module in a way it should pass.

The catch is, that this would have to be added to new module's tests to be effective, so if you remember to add the test, you'll remember to add it to the action group (mission accomplished?) but if you forget to add the test, you'll also forget to add it to the action group, and the test will not catch it (mission failed).

I might have to look at this another way, maybe something a bit more meta, like a general test that reads lists all the modules in the collection, parses meta/runtime.yml, and throws an error if any modules are not included. There'd be an exclude file somewhere so that modules that shouldn't be in the group can be excluded, that way the test will fail unless you either add the module to the action group, or add it to the exclusion list.

This kind of only works for as long as there is a single action group where most modules are expected to go. That will probably remain the case, but some revisiting will be needed if new action groups are created.

I suppose the same idea works: either add the module to any group or mark it as excluded.

ISSUE TYPE
ADDITIONAL INFORMATION

Related: #251

felixfontein commented 2 years ago

I might have to look at this another way, maybe something a but more meta, like a general test that reads lists all the modules in the collection, parses meta/runtime.yml, and throws an error if any modules are not included. There'd be an exclude file somewhere so that modules that shouldn't be in the group can be excluded, that way the test will fail unless you either add the module to the action group, or add it to the exclusion list.

:+1: I would do it like this.