0

When running kitchen converge I get the follow error:

================================================================================  
Error expanding the run_list:
================================================================================  
Missing Role(s) in Run List:

What do I need to do so that the test kitchen run can find the role? I'm running from the chef-repo/ directory that contains the roles/ directory.

kitchen.yml file contents

---
driver:
  name: vagrant

provisioner:
  name: chef_solo
  roles_path: ./roles

platforms:
  - name: centos-7.1

suites:
  - name: default
    run_list: role['role-name']
    attributes:
abc123
  • 17,855
  • 7
  • 52
  • 82
Johnny5
  • 463
  • 2
  • 5
  • 16

1 Answers1

0

You need to configure the roles path on the provisioner to use roles with Kitchen, and this is generally not recommended as it is kind of against the point.

Conrado
  • 1,402
  • 17
  • 23
coderanger
  • 52,400
  • 4
  • 52
  • 75
  • sorry, didn't see your reply – Johnny5 Dec 08 '15 at 19:57
  • would you kindly elaborate a little bit about why it's against the point? – Johnny5 Dec 08 '15 at 19:58
  • Test Kitchen is a cookbook testing tool, it works best when testing single cookbooks in isolation. Testing a role is harder because it relies on Chef's version solution to know what actual cookbooks will be used in the end so you can't test as usefully. – coderanger Dec 08 '15 at 20:01
  • Where can I find the correct syntax to add the roles path on the provisioner? I looked at the chef docs, google, and the kitchenci site, but I couldn't find it. I guess'd it might be this: provisioner: name: chef_solo roles_path: roles/ and tried that. The roles/ with the rolename.rb files is indeed right there where the .kitchen.yml file is. Still the same error though when running kitchen test, "Missing Roles in the Run List" – Johnny5 Dec 08 '15 at 21:55
  • That is indeed the value, see https://github.com/test-kitchen/test-kitchen/blob/master/lib/kitchen/provisioner/chef_base.rb#L71-L74 for the relevant code. – coderanger Dec 08 '15 at 23:16
  • For future reference: https://stackoverflow.com/questions/43586096/can-we-add-a-role-in-kitchen-yml Under provisioner, add role_path: /path/to/roles – Moshe Zvi Aug 07 '20 at 00:40