Closed cowgill closed 7 years ago
Howdy,
We've experienced similar behavior. For the 404, it helps to see what URL is returning the error. I ended up putting puts
statements inside the chef code in the kitchen VM. There's probably a simpler way to do this, but I followed this gist:
https://gist.github.com/mattjbarlow/242b66cdae6938d34419
which gets you to executing the recipe inside the VM that kitchen setup. The stacktrace is more informative in there, and I put some puts
statements in the chef http.rb file right before the response error handler.
For my case, I found that one of the groups that was in the databag did not exist, so it was failing the databag search, and resulting in a 404.
HOWEVER, if you're using the chef-client cookbook to manage the client.rb of the node, you can also override the URL the the client uses to get to chef-zero, instead sending the client to your real Chef Server. If you do that, you'll probably see a 401 Unauthorized error.
I'm not able to reproduce this with the 5.0 version of the cookbook. I've added 2 different tests for deletion of users: a user that exists on the system, and a user that does not exist. Both work just fine.
@cowgill , because your kitchen.yml
file didn't include the data bag directory.
If your data bag json file in inside your cookbook directory my_test_cookbook/data_bag/users/cowgill.json
then you can add this to your kitchen yml file:
suites:
- name: default
data_bags_path: "data_bags"
the same as your test kitchen scripts, must tell the kitchen the path.
Cookbook version
3.0.0
Chef-client version
12.13.37
Platform Details
MacBook Pro mid 2012. El Capitan 10.11.6. Kitchen Test Vagrant Ubuntu 16.04 Chef Development Kit Version: 0.17.17 berks version: 4.3.5 kitchen version: 1.11.1
Scenario:
Trying to build a test kitchen following this tutorial. I've got all the files setup correctly with users in the
data_bags/users
dir.Steps to Reproduce:
kitchen.yml
metadata.rb
recipes/default.rb
Expected Result:
The test kitchen to load without any errors and create the user and group.
Actual Result: