The Testing Clouds at 128bpm blog – authored by my esteemed colleague Vic Iglesias – is dedicated on providing information about implementing an automated, robust test framework for Eucalyptus cloud deployments with Eutester. Today’s post was inspired by the Eutester project and the blog post Eutester Basics Part 2: Setting Up a Development Environment.
In the Eutester Basics Part 2 blog entry, the development environment is focused on being set up on an Ubuntu system. To share the Eutester wealth, the steps documented in the blog have been modified to address setting up a development environment on Mac OS X Lion.
This blog assumes the following has been installed:
Once the prereqs are set, its on to setting up the environment.
As stated in the Eutester Basics Part 2 blog, Python 2.6 is required. Python 2.7 will be used in this setup. In addition to Python 2.7, we need to make sure that py27-distribute (Replacement for setuptools) and py27-virtualenv (Virtual Python Environment builder) are installed as well. Run the following command to install these packages via MacPorts:
sudo port install python27 py27-distribute py27-virtualenv
Setting Up Your Virtual Env and Installing Required Modules
Now we are ready to set up things up for Eutester.
- Create the virtual Python environment:
- Enter the environment that was just created:
- Install required modules. Here I will deviate a bit and install ipython as well:
easy_install ipython readline boto paramiko
- Since Mac OS X Lion includes git, we can go ahead and download eutester:
git clone git://github.com/eucalyptus/eutester.git
- Navigate to the eutester directory, and install eutester using ipython:
cd eutester; ipython setup.py install
From here on out, just follow the instructions under the sections “Setting up your Eucarc file” and “Configuring Python shell for tab complete and history” in the Eutester Basics Part 2 blog.
When you are ready to start the virtual Python environment, instead of using python, use ipython instead:
In my opinion, ipython makes it a bit easier to develop eutester scripts in an interactive environment. The real power is with the “?” feature. If you aren’t sure what arguments a given method accepts, just use the “?”:
(eutester-dev)Nodachi-2:~ hspencer$ ./Desktop/eutester-dev/bin/ipython
Python 2.7.3 (default, Apr 14 2012, 19:55:34)
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In : from eucaops import Eucaops
In : tester = Eucaops(credpath="/Users/hspencer/Desktop/eutester-dev")
[2012-04-15 16:51:10,392] [EUTESTER] [DEBUG]: Extracting keys from /Users/hspencer/Desktop/eutester-dev
In : tester.get_current_resources(?
Base Class: <type 'instancemethod'>
String Form:<bound method Eucaops.get_current_resources of <eucaops.Eucaops object at 0x107b99b50>>
Definition: tester.get_current_resources(self, verbose=False)
Return a dictionary with all known resources the system has. Optional pass the verbose=True flag to print this info to the logs
Included resources are: addresses, images, instances, key_pairs, security_groups, snapshots, volumes, zones
On to writing more eutester test cases….Enjoy!