Brewing is Always Welcome on Cloud 10 Too: Eutester, Brew, and Mac OS X Lion

When I finished my last blog, I realized I left out a key group of developers on Mac OS X.  I didn’t want to leave out my Homebrew fans, so this blog is dedicated to the brew users out there in the world.  For those who don’t know, Homebrew is an alternative package manager to MacPorts on the Mac OS X platform.  I am a MacPorts person myself, but I always believe that you should challenge yourself by learning different tools.

Since this is a follow-up blog, it will be short and sweet.  The blog entitled “This is the Green Room” has a great entry on setting up Homebrew on Mac OS X Lion.  We will reference this blog, with some minor tweaks of course..:-).

Prerequisites

As in my last blog, there are prerequisites.  The following is needed:

After the prereqs are met, its time to get to brewing…

Dependencies

As referenced in here, install Homebrew.

Next we will install Python. This can also be referenced in the blog as well. Run the following commands:

brew install readline sqlite gdbm pkg-config
brew install python --framework --universal

To make sure that the newly installed python is used, create or edit the .bash_profile file by adding the following line:

export PATH=/usr/local/share/python:/usr/local/bin:$PATH

Once that is done, source the .bash_profile file:

source .bash_profile

Next, we need to change Lion’s symlink to point to the new Python installation.  Run the following commands:

cd /System/Library/Frameworks/Python.framework/Versions/
sudo rm -rf Current
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current

Next we install Pip.  This also is referenced in the blog. To install Pip, run the following command:

easy_install pip

After Pip is done installing, its time to install virtualenv:

pip install virtualenv

From here on out, you just need to reference my previous blog, starting from the section “Setting Up Your Virtual Env and Installing the Required Modules”.

As always, I hope you enjoyed this blog.  On to more Eutester-ing…

Brewing is Always Welcome on Cloud 10 Too: Eutester, Brew, and Mac OS X Lion

On Cloud 10: Eutester, MacPorts and Mac OS X Lion

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.

  1. Create the virtual Python environment:  

    virtualenv eutester-dev

  2. Enter the environment that was just created:  

    source eutester-dev/bin/activate

  3. Install required modules.  Here I will deviate a bit and install ipython as well:  

    easy_install ipython readline boto paramiko

  4. Since Mac OS X Lion includes git, we can go ahead and download eutester:  

    git clone git://github.com/eucalyptus/eutester.git

  5. 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!

On Cloud 10: Eutester, MacPorts and Mac OS X Lion