Write tests for wrapper-cookbooks OR for community cookbooks?


#1

I’m trying to start using community cookbooks(to update the current one’s
and to contribute more) and wrapping them in our organization-level
cookbooks.
My environment is: latest Chef-server, Berkshelf, test-kitchen, Chef-zero,
Jenkins-CI.

There are two main purposes of creating wrappers for every community
cookbook:

  • I don’t have a general Berksfile, so I need to tell Bekshelf and Jenkins
    CI about my cookbook and it’s dependencies;
  • I need to modify cookbooks behaviour to get it working with other private
    cookbooks;

At this point I have two questions:

  1. Should I write tests for cookbooks-wrappers OR fork upstream cookbooks
    and add tests there? Or should I do both? If I should do both then how to
    separate them?
    Ideally I don’t want to have community’s cookbooks on my local filesystem
    since they’re being loaded into Chef-server by Berkshelf from community
    site, but I need to run tests for them as well.

  2. I’m creating $cookbook/tests/fixtures/data_bags/sample/someuser.json to
    use it in tests and test-kitchen uploads it for me to chef-zero server
    automatically. How can I load the data from that data_bag in my
    tests/integration/some_test.rb so I can create a test that checks if
    everything is created correct on the node?
    For example for users cookbook I’m creating a sample user and I want to
    create a test that loads that sample user and checks wether it exists.


Best regards,
Anton