I’ve been spending some time writing step files for cucumber that will interact with libvirt and cobbler.

This enables you to include steps such as the following in your scenarios:

Feature: Testing Vhosts
This feature is to be used to create and manage vhosts

Scenario: Provision the server
Given that I want to build a server of type “test”
Then I should be able to connect to the provisioning server
And I should recieve an XML file
And I should create the virtual machine

Scenario: Check the server has been built
Given that I want to confirm the server “test” has been provisioned
Then I should check the status of the server
And the server should have a status of “running”

The above scenarios will connect to cobbler, request the data for the server that has been specified, create the libvirt XML file and then define the storage/vm and launch them.  It then checks the status and confirms that the status requested is the current state of the machine.

The code is on github at http://github.com/proffalken/cucumber-vhost and updates will be reasonably rapid as I work towards the completion of phase 1 of this project.

Please note that you will need rubygems, cucumber and the “libvirt-ruby” gem installed in order for this to work.

Configuration is in features/support/env.rb and is (I hope) relatively straight forward to understand.

Currently the system only works with the qemu interface to libvirt as that’s the one I use, however I’m hoping to change that in the coming days.