← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/lp-dev-utils/cs-test into lp:lp-dev-utils

 

Aaron Bentley has proposed merging lp:~abentley/lp-dev-utils/cs-test into lp:lp-dev-utils.

Commit message:
Add cs-test script that creates a test env on Canonistack.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~abentley/lp-dev-utils/cs-test/+merge/133712

This branch adds cs-test, a script for setting up a test environment on CanoniStack.  It uses clould-init and lp-setup to do this.  The idea is that it will eventually be able to replace ec2 land.  For now, it's a bash script, but I could imagine turning it into Python.

Right now, it's good for running a subset of tests, but since it runs on Quantal, there are a few test failures.  (It runs on Quantal because that's the easiest place to get python-shelltoolbox.)

It works by emitting a script that can be supplied to --user-data, and then running euca-run-instances appropriately.
-- 
https://code.launchpad.net/~abentley/lp-dev-utils/cs-test/+merge/133712
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/lp-dev-utils/cs-test into lp:lp-dev-utils.
=== added file 'cs-test'
--- cs-test	1970-01-01 00:00:00 +0000
+++ cs-test	2012-11-09 16:50:26 +0000
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+branch=$(bzr config public_branch|sed s/^bzr+ssh/http/)
+email=$(bzr whoami --email)
+full_name=$(bzr whoami | sed -E 's/ [<].*$]*//')
+launchpad_username=$(bzr config launchpad_username)
+cloud_init_script=$(mktemp)
+cat >$cloud_init_script << EOT
+#!/bin/sh
+set -e
+apt-get install -y lxc python-shelltoolbox python-pocket-lint python-nose python-germinate
+mkdir -p /opt/launchpad
+chown ubuntu /opt/launchpad
+cd /opt/launchpad
+wget http://bazaar.launchpad.net/~canonical-launchpad-branches/lpsetup/trunk/tarball -O lpsetup.tar.gz
+wget http://bazaar.launchpad.net/~launchpad/lp-source-dependencies/trunk/tarball -O download-cache.tar.gz
+mkdir lpsetup
+tar --strip-components 3 -xzvf lpsetup.tar.gz -C lpsetup
+cd lpsetup
+python setup.py install
+yes | lp-setup init-target -f '$full_name' -l $launchpad_username -E $email -u ubuntu
+su ubuntu -c 'bzr checkout --lightweight $branch ../launchpad'
+cd ../launchpad
+su ubuntu -c 'utilities/update-sourcecode'
+su ubuntu -c 'mkdir download-cache'
+su ubuntu -c 'tar --strip-components 3 -xzvf ../download-cache.tar.gz -C download-cache'
+su ubuntu -c 'make schema'
+EOT
+. $HOME/.canonistack/novarc
+euca-run-instances ami-00000168 -t m1.small -k ${OS_USERNAME}_$OS_REGION_NAME --user-data-file $cloud_init_script