ruby,chef,test-kitchen,serverspec
You would have to load it very manually, probably add the temp folder holding the cookbook data to the load path, I think it is under /tmp/kitchen/cookbooks. Add the correct libraries/ folder and then require as per normal. Overall the converge and verify phases have nothing to do with each...
Is there a reason to specify these attributes in kitchen's yaml and not recipe[example_server::deploy_all_artifacts]? If necessary you could set overrides in kitchen. Also, this post might be helpful: Access Attributes Across Recipes...
ruby-on-rails,postgresql,chef-solo,test-kitchen
I finally abandoned the opscode postgresql cook book and went with this: attributes/default.rb default ['lsb']['codename'] = 'trusty' default['postgresql']['version'] = '9.3' In my postgresql-server recipe: file "remove deprecated Pitti PPA apt repository" do action :delete path "/etc/apt/sources.list.d/pitti-postgresql-ppa" end bash "adding postgresql repo" do user "root" code <<-EOC echo "deb http://apt.postgresql.org/pub/repos/apt/ #{node['lsb']['codename']}-pgdg...
The problem might be that the bento box which test-kitchen is using for platform ubuntu-1004 was not built with a new enough version of chef pre-installed. Therefore, the -z flag for using chef_zero provisioner is not available! To fix this, make sure to set require_chef_omnibus: latest in .kitchen.yml: --- driver:...
You can use duplicate suite names to converge a node twice (or more times). e.g. in your .kitchen.yml to run the "default" suite twice: suites: - name: default run_list: - recipe[your-cookbook::recipe] attributes: - name: default run_list: - recipe[your-cookbook::recipe] attributes: However maybe you want to use ChefSpec to test it without...
'my_cookbook': 'files_copy_to_guest': - 'home/kevin/bin/script.sh' : '/vagrant/unix_scripts/script.sh' 'home/kevin/script2.sh' : '/vagrant/unix_scripts/script2.sh' It looks to me like the problem is with your YAML. You have a - line which denotes the beginning of an array, so your object is coming out looking like this: { 'my_cookbook' => { 'files_copy_to_guest' => [ { 'home/kevin/bin/script.sh'...
ruby,vagrant,chef,vagrantfile,test-kitchen
Test Kitchen processes .kitchen.yml via ERB, so you could just simply put something like this in your ERB file: attributes: foo: <%= ENV['STUFF'] %> And then node['foo'] would contain $STUFF. Switch STUFF to USER in your case....
amazon-ec2,chef,chef-recipe,test-kitchen
I'm not sure if this is what you're looking for but you can access all servers configuration in your recipe via search, e.g.: search(:node, 'recipes:"recipe#2"') And then iterate over results to access nodes configuration. An example, used for populating /etc/hosts. I'm using knife-ec2, I'm not sure if kitchen-ec2 provides all...
I had same problem. try openstack_auth_url: http://openstack_controller:35357/v2.0/ or http://openstack_controller:5000/v2.0/tokens it worked for me :)...
One way is to use the minitest-handler cookbook. If this cookbook is included in your run, then all minitest tests present in files/default/tests/ are executed at the end of your run, and the Chef run either fails if tests fail, or succeeds if all tests passed. Then on top of...
amazon-ec2,vagrant,amazon-vpc,test-kitchen
Looks like I needed to add the following to my .kitchen.yml: driver: name: ec2 interface: private The docs say: interface The place from which to derive the hostname for communicating with the instance. May be dns, public or private. If this is unset, the driver will derive the hostname by...
unit-testing,chef,vagrantfile,test-kitchen
This isn't supported directly, but you can copy the default Vagrantfile.erb and set driver: name: vagrant vagrantfile_erb: path/to/your/Vagrantfile.erb or possibly: (I forget which is needed) driver: name: vagrant config: vagrantfile_erb: path/to/your/Vagrantfile.erb ...
vagrant,chef,vagrantfile,chef-solo,test-kitchen
I'd suggest you just use chef-zero provisioner for foodcritic. provisioner: name: chef_zero data_bags_path: /some/path ... That will spin up a temporary chef-zero server on the host box, and make it available to the foodcritic run. This also saves you the major overhead of a second server running. The only setback...
Why do you want to distribute the cookbooks? The entire point of tools like Berkshelf/Bundler is so that you don't have to share cookbooks. When you install your cookbooks with Berkshelf, Berkshelf will generate a lockfile. This lockfile contains the list of all the cookbooks and their location. Then you...
windows,vagrant,chef,test-kitchen
As per this excellent blog post from Matt Wrock, you need to use cutting edge test-kitchen and kitchen-vagrant. With all credit to Matt Wrock, he helped me figure out which versions. The tl;dr is: Use the windows-guest-support branch of test-kitchen Use the Transport branch of kitchen-vagrant If you're using a...
For search to work under chef_zero you'll need to provide a folder of node objects as JSON to be the data that gets searched. Search won't find the current node unless it is on the server (which it isn't unless you add it to that nodes/ folder. The usual fix...
I have replaced sudo_wrapper call to 'which lxc-create' in plugin source with simple puts sudo which lxc-create and got output telling me that sudo requires tty. Commenting out line 'Defaults requiretty' in /etc/sudoers solved this problem.
I do not believe this is supported. According to the kitchen docs, the only supported option is for setting the log level, not the user. If this is something you need, I'd recommend filing a feature request.
ruby,spring-boot,chef,test-kitchen
While it is somewhat counter-intuitive, this is probably because you don't have java available on your $PATH. This might mean java is not installed, or that it is installed but not in a way that Chef can find it. Remember that environment variables are only inherited when a process starts,...
This would be dependent on which test runner you are using, but for Serverspec: describe command('openssl --version'), :if => os[:family] == 'ubuntu' do its(:stdout) { is_expected.to include '1.0.1-4ubuntu5.11' } end (untested, but note the use of the os[:family] helper)...
integration-testing,chef-solo,test-kitchen,serverspec
For now i went on with idea 2. Also created a feature request: https://github.com/test-kitchen/test-kitchen/issues/598
ruby,integration-testing,hidden-files,dotfiles,test-kitchen
The ~ shorthand is a path expansion supported by many popular shells, but it is not a true filesystem path. In effect, you are asking the file resource to look for a file .gemrc in an actual subdirectory named ~ (from an unspecified working directory, whatever it may be at...