Search code examples
chef-infratest-kitchen

include_recipe does not work with test-kitchen


I have two cookbooks "users" and "nginx". First cookbook creates users and folders for system and second cookbook installs nginx for created directories' configuration.

In kitchen.yml file I added "users:default" to run list:

---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    run_list:
      - recipe[users::default]
      - recipe[nginx::default]

and in nginx::default recipe I added include_recipe:

include_recipe "users::default"

But it does not include "users::default" when i run "kitchen converge":

Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 8 resources
       Recipe: nginx::default
         * apt_package[curl] action install
           - install version 7.35.0-1ubuntu2.6 of package curl
         * apt_package[git-core] action install
           - install version 1:1.9.1-1ubuntu0.3 of package git-core
         * apt_package[nginx] action install

What is the problem? Why I can not run "users::default" recipe in another cookbook?


Solution

  • When i use path in berksfile, it is solved:

    source 'https://supermarket.chef.io'
    
    metadata
    
    cookbook "users", path: "../../cookbooks/users"
    cookbook "swap", path: "../../cookbooks/swap"
    

    This means, use users cookbook in given path, instead of using source url