Latest commit deb3a16
Apr 27, 2011
|Failed to load latest commit information.|
cucumber-vhost ============== This was designed and written to enable me to test code on Virtual Machines without having to worry if they were provisioned correctly The system relies on Cobbler and Libvirt - there are a few posts on getting cobbler up and running on my blog: http://www.threedrunkensysadsonthe.net/ This is also still in beta! The software contained in this package are Copyright (c) 2010 Matthew Macdonald-Wallace and are released under the GPL "cucumber-vhost" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. "cucumber-vhost" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with cucumber-vhost. If not, see http://www.gnu.org/licenses/. To configure the system, you will need to edit 'config.yml' and set it up for your network EXAMPLE ======= This script is the basis for launching a VM and checking that it is up After that, it's all over to you! :) An example that uses all of the steps that are currently available is below (Comments at the end of each line following a #), feel free to add extra steps... Feature: Testing Vhosts This feature is to be used to create and manage vhosts Scenario: Provision the server # I recommend that you don't edit this scenario and have it as the first step! Given that I want to build a server of type "test" # Set the type of server to be provisioned to the system name in cobbler Then I should be able to connect to the provisioning server # Initiate the connection to Cobbler via the API And I should recieve an XML file # retrieve the XML from cobbler via the API And I should create the virtual machine # define the machine under LibVirt and create/start it Scenario: Check the server has been built Given that I want to confirm the server "test" has been provisioned # Set the system name in cobbler to be tested and connect to the API Then I should check the status of the server # Use LibVirt to get the status of the VM And the server should have a status of "running" # Confirm that the current reported status matches the requested status Scenario: Check the server has powered on correctly Given that I want to confirm the server "test" has been provisioned # Set the system name to be tested Then I should check the status of the server # Check the status And the server should have a status of "running" # Confirm it matches the running status Then I should ping the server # Ping the IP of eth0 (as defined in cobbler) of the server to confirm it is up And I should be able to connect the server on port "22" # Connect to a port to ensure a service is running  Scenario: Destroy the server Given that I want to destroy the server "test" # Again, set the system name from cobbler to be destroyed Then I should be able to connect to the provisioning server # Connect to Cobbler Then I should check the status of the server # Check the status from LibVirt of the VM And I should destroy the server # Destroy the server using LibVirt And I should destroy the associated storage # Destroy the associated Storage And I should undefine the server # Undefine the system - this removes all traces of the system  A caveat - for this to work correctly, you can't use port 22 because the Redhat Installer starts a SSH daemon during the install which means this test succeeds before the server is fully provisioned. I recommend setting the vale of "port" to the service that you are testing and you'll need to make sure the firewall is set to allow traffic on that port before this test will succeed. The code has been written to wait until the ping succeeds and the same is true for the port checker - if you need mroe flexibility than this, please feel free to fork and then merge back the changes!