rabbitmq / chef-cookbook

Development repository for Chef cookbook RabbitMQ
https://supermarket.chef.io/cookbooks/rabbitmq
Apache License 2.0
212 stars 425 forks source link

Fix backlash handling on permissions #566

Closed dud225 closed 4 years ago

dud225 commented 4 years ago

What types of changes does your code introduce to this project? Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask on the mailing list. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

michaelklishin commented 4 years ago

Thank you. I would like to see a test case (Test Kitchen or a bunch of unit tests for a function that would do this) to go with this change.

dud225 commented 4 years ago

Hello. It is actually difficult to test. The function where the condition that is being fixed lies serves as a guard to prevent the permissions from being set again. So to test it we would need to run Chef twice and check that the permissions are not set again on the second run.

michaelklishin commented 4 years ago

Surely the encoding part can be extracted into a library function that should be trivial to test. But we don't really have any tests for library functions and it's not 100% clear to me how these are commonly tested in the case of Chef. Perhaps as any other library functions :/