Closed craigw closed 8 years ago
I have created a verifier called serverspec which bypasses all the busser stuff.
See https://github.com/neillturner/kitchen-verifier-serverspec.
Currently it runs on the server but could easily be enhanced to support ssh running.
I also plan to enhance it to have a runner.rb script that will run and can be customized. So you might find that interesting.
I have update kitchen-verifier-serverspec to support SSH. it will not figure out the roles and host names from the playbook yaml but you should be able to run your tests by specifying the host name and the test.
NOTE: you need to install gem kitchen-verifier-serverspec on your workstation and update the .kitchen.yml file:
i.e.
verifier:
name: serverspec
suites:
- name: base
verifier:
patterns:
- roles/tomcat/spec/tomcat_spec.rb
bundler_path: '/usr/local/bin'
rspec_path: '/home/vagrant/bin'
env_vars:
TARGET_HOST: 172.28.128.7
LOGIN_USER: vagrant
SSH_KEY: 'spec/tomcat_private_key.pem'
NOTE: You then does need all the test/integration... stuff as long as your tests are in your ansible repo.
I've deprecated busser-ansible-spec you can use https://github.com/neillturner/kitchen-verifier-serverspec. and there is a ansiblespec_runner.rb that can be easily customized.
closing for now.
Hello!
First of all, thanks for your work on kitchen-ansible, it's kept us sane :)
For one of my Ansible roles, I'm trying to add a per-suite host_vars folder. It's a role that sets up a cluster of several nodes, and I want one test suite for a cluster master, and another suite for a cluster slave. I don't think they need to share the host_vars directory that I use for the slave suite to make sure it connects to a master.
The path lookup code seem stop support what I want to do by adding a directory e.g.
test/integration/slave/ansible/host_vars
: https://github.com/neillturner/kitchen-ansible/blob/master/lib/kitchen/provisioner/ansible/config.rb#L151-L152. The converge stage works as expected when I create this directory, which supports my feeling that this is what I should do.Unfortunately, at verify time, any folders in the suite directory will be treated as requested Busser plugins by test-kitchen: https://github.com/test-kitchen/test-kitchen/blob/eecfaa5852baae8c69ae9f317892feebc2e546fe/lib/kitchen/verifier/busser.rb#L235-L241. They'll try to install them as gems of the format
busser-<folder_name>
. Thebusser-ansible
gem doesn't exist, so Busser fails to run the verifier and spits out an error message:I suspect that the real fix here is to patch test-kitchen to support an Ansible (or indeed a verifier configurable) style directory structure for each suite, but there are several months worth of outstanding pull requests in the test-kitchen repo. I'll tackle that when I get time to understand how the test-kitchen code is meant to interact with the verifier. I'd love your thoughts on how you'd like it to work, if you have an opinion on it, so I can push in the right direction for that.
Presumably however, this has been done in another way by someone else, and I'm hoping that someone can point me in a suitable direction in the short term. Can you help?
Until I find a better way to work, I do have a sort of work-around: I'm adding the host_vars directory for this suite to my role directory root. That does mean the host_vars are shared with all the test suites - but they still pass, so it's an acceptable work-around for the moment.
Thanks for your time!
Craig