Monday, March 5, 2012

First steps with Eutester


In one of my previous post I mention our mantra: "Listen to our community and deliver quality software". To deliver quality software, it is necessary to have the QA process as a first class citizen. Our QA team created quite a spectacular infrastructure to test all sort of combinations and configurations automatically (distro, architectures, versions, hypervisors, networking, images etc ...) to guarantee our users, regression-free releases. They also managed to have fun in the process (check out Pigeons on a Euca).

Eutester is the latest brainchild of our QA team, and this blog is about my experience writing a test using it. Eutester is a framework to create automatic tests against a Eucalyptus installations (or any cloud following the AWS API for that matter).

 These are the ingredients I needed to bake my first test:
  • a really annoying bug
  • a Eucalyptus cloud to test it against
  • the Eutester framework
  • basic python knowledge helps although it is not necessary
Let's start with the main ingredient: a really annoying bug. I picked lp:737335, annoying and small enough for me to tackle. The issue reported is that the launch permissions as set by euca-modify-image-attribute are not respected in Eucalyptus 2.0. The bug happened also to have a proposed fix.

 Next: reproduce the issue on a Eucalyptus cloud of the desired version. This bug is easy to reproduce: I just need to upload an image, change the launch permission to remove all user, then try to launch it: if the instance starts the issue is present. Since I wanted to test the proposed patch, I did installed Eucalyptus 2.0.3, compiling it from source. Lester also tested it against the development branch of Eucalyptus 3.1 (check Andy's blog to work with the devel branch, and Greg's blog for more info on 3.next) and confirmed that only 2.0 is affected.

 I then downloaded Eutester, installed it locally on my client machine and started to hack the test. I used virtualenv to ensure a clean, reproducible environment to work with. My first attempt of the test successfully reproduced the issue, so I gingerly submitted it for integration. The QA team is still laughing at my python skills ... They kindly reworked the test and it is now sitting into the Eutester repository. With the new test added to a sequence in our QA system I am now guaranteed that all future version of Eucalyptus will be tested for regression against this issue.

 Onward to the patch for 2.0. I created a branch with the fix, and proposed it for merging. The QA system caught my sloppy programming at the first attempt (typo), but the second version was the win: QA passed with flying colors and the branch was eventually merged into the top of the Eucalyptus 2.0 branch.

Quite an accomplishment here: my first python script, my first Eutester test and no more lp:737335, just the perfect happy ending for this blog.