You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a recipe that assembles a data bag item name depending on node.policy_group. Now I need a way to test this. My first idea is to simple mock the policy_group in my specs. But how would I do that? I didn't come across anything in the ChefSpec README. A hint is appreciated since we are currently in some kind of deadlock here and don't know how to test this at all. Testing this with test-kitchen seems very tedious.
The text was updated successfully, but these errors were encountered:
I've been banging my head against this for a while now but I think I have a way that works:
beforedochef_runner.node.policy_group= <your-policy-group>
end
The above will mock the policy group in your chef run (for the recipe code to work)
If you need to access the policy group of the node in chefspec tests I think accessing it the same way (chef_runner.node.policy_group) will get you the value.
I have a recipe that assembles a data bag item name depending on
node.policy_group
. Now I need a way to test this. My first idea is to simple mock the policy_group in my specs. But how would I do that? I didn't come across anything in the ChefSpec README. A hint is appreciated since we are currently in some kind of deadlock here and don't know how to test this at all. Testing this with test-kitchen seems very tedious.The text was updated successfully, but these errors were encountered: