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.
Prerequisites
This blog assumes the following has been installed:
Once the prereqs are set, its on to setting up the environment.
Dependencies
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:
virtualenv eutester-dev
- Enter the environment that was just created:
source eutester-dev/bin/activate
- 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:
./Desktop/eutester-dev/bin/ipython
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 [1]: from eucaops import Eucaops
In [2]: 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 [3]: tester.get_current_resources(?
Type: instancemethod
Base Class: <type 'instancemethod'>
String Form:<bound method Eucaops.get_current_resources of <eucaops.Eucaops object at 0x107b99b50>>
Namespace: Interactive
File: /Users/hspencer/Desktop/eutester-dev/lib/python2.7/site-packages/eutester-0.0.1-py2.7.egg/eucaops/__init__.py
Definition: tester.get_current_resources(self, verbose=False)
Docstring:
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
In [4]:
On to writing more eutester test cases….Enjoy!