← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/lpsetup/run-integration-tests-in-tarmac into lp:lpsetup

 

Brad Crittenden has proposed merging lp:~bac/lpsetup/run-integration-tests-in-tarmac into lp:lpsetup.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~bac/lpsetup/run-integration-tests-in-tarmac/+merge/117910

* Change pre-commit.sh to run the install_lxc integration test.

* Instead of downloading the real download-cache in the test, use a stub version that is basically empty.  This should speed up the test considerably.  (I say "should" because my manual tests have been all over the map.  The tests are highly dependent on network bandwidth and the variability in my environment on network usage is really high.)



-- 
https://code.launchpad.net/~bac/lpsetup/run-integration-tests-in-tarmac/+merge/117910
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/lpsetup/run-integration-tests-in-tarmac into lp:lpsetup.
=== modified file 'lpsetup/subcommands/install_lxc.py'
--- lpsetup/subcommands/install_lxc.py	2012-07-31 09:31:14 +0000
+++ lpsetup/subcommands/install_lxc.py	2012-08-02 14:42:33 +0000
@@ -101,8 +101,9 @@
 
 def update_in_lxc(
     lxc_name, ssh_key_path, home_dir, user, external_path,
-    target_dir, use_http):
-    args = ['update', target_dir, '--external-path', external_path]
+    target_dir, lp_source_deps, use_http):
+    args = ['update', target_dir, '--external-path', external_path,
+            '--lp-source-deps', lp_source_deps]
     if use_http:
         args.append('--use-http')
     cmd_in_lxc(lxc_name, ssh_key_path, home_dir, args, as_user=user)
@@ -136,7 +137,7 @@
          'lxc_name', 'ssh_key_path', 'home_dir', 'user', 'source', 'use_http',
          'branch_name', 'checkout_name', 'repository', 'no_checkout'),
         (update_in_lxc, 'lxc_name', 'ssh_key_path', 'home_dir', 'user',
-         'external_path', 'target_dir', 'use_http'),
+         'external_path', 'target_dir', 'lp_source_deps', 'use_http'),
         (finish_inithost_in_lxc, 'lxc_name', 'ssh_key_path', 'home_dir',
          'user', 'target_dir'),
         # Run on host:

=== modified file 'lpsetup/subcommands/update.py'
--- lpsetup/subcommands/update.py	2012-08-01 15:26:38 +0000
+++ lpsetup/subcommands/update.py	2012-08-02 14:42:33 +0000
@@ -35,7 +35,7 @@
 """
 
 
-def update_dependencies(target_dir, external_path, use_http):
+def update_dependencies(target_dir, external_path, use_http, lp_source_deps):
     """Update the external dependencies."""
     use_http_param = '--use-http' if use_http else None
     cmd = os.path.join(target_dir, 'utilities', 'update-sourcecode')
@@ -49,8 +49,12 @@
     if os.path.exists(download_cache):
         call('bzr', 'up', download_cache)
     else:
+<<<<<<< TREE
         call('bzr', 'co', '-v', '--lightweight',
              LP_SOURCE_DEPS, download_cache)
+=======
+        run('bzr', 'co', '-v', '--lightweight', lp_source_deps, download_cache)
+>>>>>>> MERGE-SOURCE
 
     # Link to the external sourcecode.
     if abs_external_path != target_dir:
@@ -84,7 +88,8 @@
     has_interactive_run = False
     steps = (
         (initialize_directories, 'target_dir', 'external_path'),
-        (update_dependencies, 'target_dir', 'external_path', 'use_http'),
+        (update_dependencies,
+           'target_dir', 'external_path', 'use_http', 'lp_source_deps'),
         (update_tree, 'target_dir'),
         )
     help = __doc__
@@ -101,6 +106,10 @@
             help='Path to directory that contains sourcecode '
                  'and download-cache directories, relative to the '
                  'working-dir. ')
+        parser.add_argument(
+            '--lp-source-deps', default=LP_SOURCE_DEPS,
+            help='URL of LP source deps branch.  '
+                 '[DEFAULT={0}]'.format(LP_SOURCE_DEPS))
 
     def add_arguments(self, parser):
         super(SubCommand, self).add_arguments(parser)

=== modified file 'lpsetup/tests/integration/common.py'
--- lpsetup/tests/integration/common.py	2012-07-24 17:59:58 +0000
+++ lpsetup/tests/integration/common.py	2012-08-02 14:42:33 +0000
@@ -105,6 +105,7 @@
         self.banner('Cleaning up.')
         code = os.system(
             'echo y | juju destroy-environment -e {}'.format(self.juju_env))
+        print
         if code != 0:
             raise RuntimeError('Destroying the test juju environment failed.')
 
@@ -136,4 +137,4 @@
         finally:
             if not self.args.no_tear_down:
                 self.tear_down()
-            print "Run time: ", datetime.now() - start_time
+            self.banner("Run time: {}".format(datetime.now() - start_time))

=== modified file 'lpsetup/tests/integration/test_install_lxc.py'
--- lpsetup/tests/integration/test_install_lxc.py	2012-07-31 08:08:51 +0000
+++ lpsetup/tests/integration/test_install_lxc.py	2012-08-02 14:42:33 +0000
@@ -92,11 +92,14 @@
         urlparts = list(urlparse.urlsplit(self.push_location))
         urlparts[0] = 'http'
         branch_location = urlparse.urlunsplit(urlparts)
-        lp_source = 'http://bazaar.launchpad.net/~yellow/launchpad/stub'
+        lp_source_stub = 'http://bazaar.launchpad.net/~yellow/launchpad/stub'
+        lp_source_deps_stub = (
+            'http://bazaar.launchpad.net/~yellow/lp-source-dependencies/stub')
         cmd = (
             'lpsetup/lp-setup install-lxc --use-http '
-            '--source {} -B {} -r {} --yes'.format(
-            lp_source, branch_location, self.repo))
+            '--source {} -B {} -r {} --yes '
+            '--lp-source-deps {}'.format(
+            lp_source_stub, branch_location, self.repo, lp_source_deps_stub))
         self.on_remote(cmd)
 
 

=== modified file 'lpsetup/tests/subcommands/test_install_lxc.py'
--- lpsetup/tests/subcommands/test_install_lxc.py	2012-07-24 10:14:18 +0000
+++ lpsetup/tests/subcommands/test_install_lxc.py	2012-08-02 14:42:33 +0000
@@ -29,7 +29,7 @@
 update_in_lxc_step = (
     install_lxc.update_in_lxc, [
         'lxc_name', 'ssh_key_path', 'home_dir', 'user', 'external_path',
-        'target_dir', 'use_http',
+        'target_dir', 'lp_source_deps', 'use_http',
         ])
 
 finish_inithost_in_lxc_step = (

=== modified file 'lpsetup/tests/subcommands/test_update.py'
--- lpsetup/tests/subcommands/test_update.py	2012-07-20 10:40:43 +0000
+++ lpsetup/tests/subcommands/test_update.py	2012-08-02 14:42:33 +0000
@@ -26,7 +26,8 @@
 init_dir_step = (
     update.initialize_directories, ['target_dir', 'external_path'])
 update_dep_step = (
-    update.update_dependencies, ['target_dir', 'external_path', 'use_http'])
+    update.update_dependencies, ['target_dir', 'external_path', 'use_http',
+                                 'lp_source_deps'])
 update_tree_step = (update.update_tree, ['target_dir'])
 
 

=== modified file 'pre-commit.sh'
--- pre-commit.sh	2012-07-19 17:48:40 +0000
+++ pre-commit.sh	2012-08-02 14:42:33 +0000
@@ -1,4 +1,8 @@
-#!/bin/bash
-
+#!/bin/bash -x
+# Exit on the first failure
+set -o errexit
 pyfiles=`find . -name build -prune -o -name "*.py" | grep -v distribute_setup.py`
-pocketlint $pyfiles && pep8 --exclude=build $pyfiles && nosetests
+pocketlint $pyfiles
+pep8 --exclude=build $pyfiles
+nosetests
+lpsetup/tests/integration/test_install_lxc.py