cucumber-nagios
cucumber-nagios copied to clipboard
Extracting Nagios part of this library to make it useful for development mode
Hi,
I have been in search for a library that can help me with the (behaviour driven) development of a system setup with Chef cookbooks. So far this library has been the best I have come accross, but it is not exactly what I want.
What I would like to do is test my Chef Recipes by describing the expected outcome in Cucumber features (like with Cucumber-Nagios), but instead of having to use a remote server and having integration with Nagios I would like to use Vagrant and just see whether my test pass or not. Later I would like to plug these tests into Cucumber-Nagios to reuse them for monitoring.
I'm guessing that we are almost there. I think it is just a matter of extracting the server connecting part (not remote, but localhost) and the output part (no Nagios but just plain Cucumber output). The step definitions and such are probably already in the form they should be.
In the near future I would like to work on this if you also agree that this would be a worthwhile expansion of the current library. WDYT?
Regards,
Jeroen
Hoi, Dat belooft wat! cucumber-nagios almost does exactly what you want out of the box right now.
I've been using cucumber-nagios for a few projects in the way you've described and it's worked out really well. It would be good to formalise this with some documentation and examples.
Currently you can run cucumber-nagios with the --pretty
flag to get the nice output:
bin/cucumber-nagios features/site/blah.feature --pretty
I use this frequently when writing my scenarios.
You can skip over removing the server connecting part by just writing steps that can be executed locally. Adam Jacob from Opscode actually contributed a bunch of step definitions from Chef's test suite to cucumber-nagios a while back.
They should give you a good starting point for writing your own step definitions that can be run locally.
That said, I'm sure there a few rough edges and things that I've missed. Any contributions to cucumber-nagios you want to make would be really worthwhile.
How does that sound?
(Dutch, really? haha. Klinkt goed :) )
I'll look into the --pretty option. That might be good enough. I'll just start working with it and comment here as soon as I have something (re)usable :)
(Mijn schoonvader komt uit Nijmegen :-) )
Sounds awesome. Let me know how you go!
I'm adding tests to my chef/vagrant setup right now, I'm not sure I understand what features would make this more awesome.
I'm just running cucumber -r features features/vagrancy.feature
and it works great.
I would totally love a good set of vagrant steps though.
@josephholsten: is it possible to extract any of the Vagrant features/scenarios/steps out into re-usable bits for cucumber-nagios?
I'm building my vagrant steps around aruba because it has better isolation than the file system steps from chef. But I certainly hope so. At the moment I'm making due with these steps:
Given /^a freshly built package "([^"]*)"/ do |package|
When %{I run "vagrant destroy"}
Given %{a Vagrantfile from package #{package}"}
When %{I run "vagrant up"}
Then %{the exit status should be 0}
Then %{the output should contain "Chef Run complete"}
end
Given /^a provisioned package "([^"]*)"$/ do |package|
Given %{a Vagrantfile from package "#{package}"}
When %{I run "vagrant up"}
When %{I run "vagrant provision"}
Then %{the exit status should be 0}
Then %{the output should contain "Chef Run complete"}
end
Given /^a Vagrantfile from package "([^"]*)"$/ do |package|
use_vagrantfile(package)
end
def use_vagrantfile(package)
run_simple("cp ../../packages/#{package}/Vagrantfile ./")
end
and I extend my timeouts and make sure to teardown in my env.rb
:
[...]
require 'aruba/cucumber'
Before do
@aruba_timeout_seconds = 750
end
at_exit do
include Aruba::Api
run_simple('vagrant destroy')
end
The best extraction would probably migrating to aruba for command line steps. Unfortunately, they collide with the ssh steps (which so useful!) at the moment, so there isn't a straightforward migration path.
Auxesis asked me to take over CN. I've refacored CN to use Aruba: https://github.com/hedgehog/cucumber-nagios and also started extracting steps to an Aruba style gem for CN, the a cuken gem: https://github.com/hedgehog/cuken