24
Jan

testing eucalyptus cloud now made easy

So last weekend I thought of trying out the Eutester project which has been up on projects.eucalyptus.com for a while and now the code been moved to github with some serious development happening.

Well for those who are new to Eutester, it is a framework written in python which helps you test your Eucalyptus private cloud setup. Remember, testing can sometime be a hard job so best to automate it as much as possible with all your test cases. Besides that there is a lot more to it. I guess using the existing code which is part of the test framework one can develop his/her own test cases for varied scenarios/bugs and contribute the same to the Eutester code on github.

For me personally it is a great tool to have in my ninja pockets, makes my job pretty easier. Imagine you have a bug on launchpad that you want to replicate in your environment? How long would it take to execute those Steps to follow to re-create the problem and now imagine one single program, a Eutester test case doing all that for you in one shot, that’s what I call smartness.

Before starting off with how the framework actually works and the various components of it (which I guess is pretty straight forward and easy to understand) I just thought of giving one of the test cases a try and hence I did a:

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

Note that in order to use Eutester you need to have certain pre-requisites installed which is understandable. Following is the list of pre-requisites:

Note that Eutester is written in python so it requires you to have python, I had python 2.6 which works well with boto 2.1 and you also need python-setuptools.

Guess where I figured all this? Well just open setup.py in the Eutester code base and you will figure that out.

There are certain other assumptions made before hand regarding the cloud environment to be tested

Once all the assumptions and pre-requisites are cleared out, next was a simple command to set Eutester on my machine:

python26 setup.py install

Well before we jump into executing our first sample test case let me point out here that Eutester provides various ways to you to feed in details on how Eutester can understand your cloud environment. Following are some of those ways (please note that there might exists other ways to get around but this post is to keep matters simple):

a) Using a cloud.conf config file

It is basically a simple text files having rows (lines) and columns. If you see the above you would find 2 lines describing the two machines in my cloud environment.

The sample cloud.conf is shown below

172.22.0.15 CENTOS 5.7 64 REPO [CC00 CLC SC00 WS]
172.22.0.16 CENTOS 5.7 64 REPO [NC00]

The column information is described in README.md file that came alone with the eutester code. But for the sake of completion of the post:

b) Passing on the eucalyptus credential path, to the constructor. In my case the credentials were on the same machine as eutester so I had to only provide the path to the credentials.

Note that based on option (b) I wrote a very simple test case which runs an instance and then prints in some instance specific information.

from eucaops import Eucaops
if __name__ == '__main__':
    tester = Eucaops(credpath="/home/jeevanullas/.euca/")
    tester.exit_on_fail = 1
    image = tester.get_emi()
    reservation = tester.run_instance(image,keypair="sshlogin",group="linuxvms",type="m1.small")
    instance = reservation.instances[0]
    print "Instance Public IP address: " + instance.ip_address
    print "Instance Private IP address: " + instance.private_ip_address
    instance.terminate()

So what this test does (at a very high level) is that it connects to the CLC and then get one of the available EMI’s which is available and boots that up. Once the instance is up and running we print some basic information about the instance like the instance private ip address as well as public ip address. Finally we terminate the instance.

There are other things which can be done before we terminate the instance like executing a remote command on the instance and using the output internally in your test case? Lots of ideas.

The output for the script above is shown in the screenshot below

eucalyptus

You can probably ignore some of the things like the boto debug stuff which is due to extensive logging enabled.

So if we summarize this post with our simple scripts here are the basic things which are pretty straight forward and Eutester takes care of

a) Takes care of getting your cloud credentials so that it can talk to your cloud and do stuff.

b) Next in order to run an instance on the cloud you need to provide EMI which Eutester gets for you based on the first available EMI and expects you to pass parameters like key pair to use for ssh logins and security group. Please note that these parameters are optional and are only required probably for a successful SSH connection to be established, infact SSH keypairs can be generated by Eutester before the instance is fired and can same can be used to while starting the instance as well as for further SSH connections inside Eutester.

Eutester is growing pretty fast thanks to Vic and Matt. Also Graziano already came up with an Eutester test case which is now part of Eutester and recreates bug 737335

There are various possibilities and lot of cool stuff happening around Eutester project. So I would suggest everyone to stay in touch and follow the project on:

Code
IRC Meetings
Projects Page

  • Asrar

    Hi,

    i’m working in a project that i use eucalyptus cloud-in-a box , my aim is to deploy Openerp over the cloud , what emi should i use ?