Setting up Cloudify local cloud integration tests

One of the things about working on Cloudify is that I use a bunch of different linux distributions at the same time. We have Cloudify users running RHEL, Suse, CentOS, Fedora, and a whole bunch of others. (Cloudify works on DamnSmallLinux too!)

With this kind of work, you want to be able to test your changes as quickly as possible. That’s what the Cloudify-iTests project is for – a suite of integration tests using just about every feature Cloudify has to offer. More often then not I’ll use the IDE to run a couple of tests, but this can be a pain to set up on a remote machine.

In this post I’ll show you how to quickly (ok, not that quickly) run an integration test on a remote machine of your choice using the console.

I’ll be using Ubuntu for this example, but that mostly matters just for installing some basic tools.

Here are the tools we will need:

  • Java – We’ll need Oracle JDK 6 to compile. (Cloudify can run on any JDK, Including OpenJDK7, but we compile with Oracle JDK 6)
  • git – Distributed source code control.
  • maven – Java build tool. 
  • ant – another Java build tool. Useful for automating simple tasks.

First, let’s set up our work directory

mkdir ~/cloudify-dev

cd ~/cloudify-dev

Now let’s install java. Since this tends to be tricky using package managers, let’s just install this one manually. 

On a 32-bit system:

wget -O java.bin http://repository.cloudifysource.org/com/oracle/java/1.6.0_32/jdk-6u32-linux-i586.bin

On a 64-bit system:

wget -O java.bin http://repository.cloudifysource.org/com/oracle/java/1.6.0_32/jdk-6u32-linux-x64.bin

Not sure if you are on 32 or 64 bit? That happens more then you think on the cloud, with image descriptions not always as accurate as they should be. Just run 

uname -m

If the output has ‘x64’ anywhere, it’s 64 bit.

To install java locally

chmod +x ./java.bin

./java.bin

and follow the onscreen instructions.

Now to set up the Java environment:

export JAVA_HOME=~/cloudify-dev/jdk1.6.0_32

export PATH=$JAVA_HOME/bin:$PATH

Now we’ll use apt to install the rest of the tools:

sudo apt-get -y install git ant maven

Ok, the tools are all set, let’s grab a copy of Cloudify and untar it. A download link to the latest milestone build is available at the early access page

wget -O cloudify.tar.gz http://repository.cloudifysource.org/org/cloudifysource/2.7.0-5984-M2/gigaspaces-cloudify-2.7.0-m2-b5984.tar.gz

tar xvfz cloudify.tar.gz

And set up the Cloudify Home environment variable

export CLOUDIFY_HOME=~/cloudify-dev/gigaspaces-cloudify-2.7.0-m2

Right, let’s go ahead and grab the cloudify sources:

git clone https://github.com/CloudifySource/cloudify

git clone https://github.com/CloudifySource/Cloudify-iTests

And build the cloudify components from the sources:

cd ~/cloudify-dev/cloudify/cloudify

mvn install

This will take a while the first time you run it – the maven build system is plugin based, and plugins are downloaded the first time they are needed – and there are a lot of them. The good news is that you only have to do this once, next time will be much quicker.

Now that you’ve built the components, let’s copy them into the cloudify home directory:

ant -f copy_jars_local.xml

Now you have the absolute latest and greatest (and occasionally slightly buggiest) code in your cloudify home directory.

Let’s see how to run a simple integration test. A typical local cloud integration test bootstraps a local cloud, runs some CLI command against the local cloud, including installing services and applications, and then uninstall everything and tears down the localcloud. We’ll just run the travel application sample – all of the services in the travel applications use Java, so it generally works everywhere Cloudify does.

cd ~/cloudify-dev/Cloudify-iTests

mvn -Dtest=org.cloudifysource.quality.iTests.test.cli.cloudify.recipes.examples.ProductExamplesTest#installTravel test

Again, maven will download a few (a lot, actually) new plugins, but this will only happen once.

That’s is. You now have a Cloudify working environment. 

Now go make an image from the system you are using so the next guy can use it too. Welcome to the cloud 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s