Merge lp:~bac/lpsetup/stub-lp into lp:lpsetup

Proposed by Brad Crittenden
Status: Merged
Approved by: Brad Crittenden
Approved revision: 71
Merged at revision: 64
Proposed branch: lp:~bac/lpsetup/stub-lp
Merge into: lp:lpsetup
Diff against target: 96 lines (+27/-23)
3 files modified
README.rst (+6/-16)
bin/setup-host-for-nested-lxc-containers.sh (+7/-0)
lpsetup/tests/integration/test_install_lxc.py (+14/-7)
To merge this branch: bzr merge lp:~bac/lpsetup/stub-lp
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+117319@code.launchpad.net

Commit message

Use a stub version of Launchpad for integration testing to avoid the hit for having to download the source branch.

Description of the change

This branch makes the lpsetup test_install_lxc.py integration test check out and use a fake Launchpad branch, so that the test can run faster.

A recent run completed in 22 minutes on my development machine.

The branch it checks out is at lp:~yellow/launchpad/stub. It only has the referenced three scripts in utilities and the minimal targets required for the Makefile. Gary suggested that the utility scripts actually touch a file to demonstrate they did something but I didn't see that doing so would be too helpful. We can add that in if it ever becomes useful.

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good. As we discussed on IRC the README should mention bin/setup-host-for-nested-lxc-containers.sh

review: Approve (code)
lp:~bac/lpsetup/stub-lp updated
71. By Brad Crittenden

Fixed README to mention the new setup script

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.rst'
2--- README.rst 2012-07-25 18:26:32 +0000
3+++ README.rst 2012-07-30 18:59:19 +0000
4@@ -115,24 +115,13 @@
5 http://www.stgraber.org/2012/05/04/lxc-in-ubuntu-12-04-lts/
6
7 For the testing scenario, the host machine must be manually changed
8-once[1] with the following modifications:
9-sudo cp lpsetup/templates/lxc-with-testing /etc/apparmor.d/lxc
10-sudo /etc/init.d/apparmor reload
11-sudo cp /usr/lib/lxc/templates/lxc-ubuntu /usr/lib/lxc/templates/lxc-ubuntu.orig
12-sudo sed -i "s/#lxc.aa_profile = unconfined/lxc.aa_profile = lxc-container-with-nesting/" \
13- /usr/lib/lxc/templates/lxc-ubuntu
14-
15-Should you want to disallow the apparmor change made to the default
16-ubuntu template:
17-sudo mv /usr/lib/lxc/templates/lxc-ubuntu.orig \
18- /usr/lib/lxc/templates/lxc-ubuntu
19-
20-The other changes mentioned are handled by the test in the container
21-launched by Juju.
22+once[1] by running bin/setup-host-for-nested-lxc-containers.sh
23+
24+The other changes mentioned in the above blog post are handled by the
25+test in the container launched by Juju.
26
27 [1] If the *lxc* package changes such that the *ubuntu* template is
28-modified, then the last two steps to update the template will be
29-required to be performed again.
30+modified, then the script will need to be run again.
31
32 Linting
33 ~~~~~~~
34@@ -177,3 +166,4 @@
35
36 cd lplxcip
37 sudo nosetests
38+
39
40=== added directory 'bin'
41=== added file 'bin/setup-host-for-nested-lxc-containers.sh'
42--- bin/setup-host-for-nested-lxc-containers.sh 1970-01-01 00:00:00 +0000
43+++ bin/setup-host-for-nested-lxc-containers.sh 2012-07-30 18:59:19 +0000
44@@ -0,0 +1,7 @@
45+#!/bin/bash
46+
47+sudo cp lpsetup/templates/lxc-container-with-nesting /etc/apparmor.d/lxc
48+sudo /etc/init.d/apparmor reload
49+sudo cp /usr/lib/lxc/templates/lxc-ubuntu /usr/lib/lxc/templates/lxc-ubuntu.orig
50+sudo sed -i "s/#lxc.aa_profile = unconfined/lxc.aa_profile = lxc-container-with-nesting/" \
51+ /usr/lib/lxc/templates/lxc-ubuntu
52
53=== renamed file 'lpsetup/templates/lxc-with-testing' => 'lpsetup/templates/lxc-container-with-nesting'
54=== modified file 'lpsetup/tests/integration/test_install_lxc.py'
55--- lpsetup/tests/integration/test_install_lxc.py 2012-07-25 17:44:02 +0000
56+++ lpsetup/tests/integration/test_install_lxc.py 2012-07-30 18:59:19 +0000
57@@ -33,7 +33,12 @@
58 def get_push_location(self, branch=None):
59 if branch is None:
60 branch = self.get_branch()
61- return branch.get_push_location()
62+ push = branch.get_push_location()
63+ if push.startswith('lp:'):
64+ # Convert to bzr+ssh or the calls to WorkingTree fail,
65+ # inexplicably.
66+ push = push.replace('lp:', 'bzr+ssh://bazaar.launchpad.net/')
67+ return push
68
69 def check_environment(self):
70 """Be sure the test environment doesn't exist."""
71@@ -48,10 +53,9 @@
72 # bzr+ssh URLs work.
73 self.branch = self.get_branch()
74 self.push_location = self.get_push_location(self.branch)
75- if self.push_location.startswith('lp:'):
76- raise RuntimeError(
77- "Push location must use http or bzr+ssh "
78- "protocol: {}".format(self.push_location))
79+ if self.push_location is None:
80+ raise RuntimeError("Push location must be set.")
81+
82 # Ensure the branch has been pushed and has no missing revisions.
83 try:
84 push_branch = self.get_branch(self.push_location)
85@@ -88,8 +92,11 @@
86 urlparts = list(urlparse.urlsplit(self.push_location))
87 urlparts[0] = 'http'
88 branch_location = urlparse.urlunsplit(urlparts)
89- cmd = 'lpsetup/lp-setup install-lxc --use-http -B {} -r {}'.format(
90- branch_location, self.repo)
91+ lp_source = 'http://bazaar.launchpad.net/~yellow/launchpad/stub'
92+ cmd = (
93+ 'lpsetup/lp-setup install-lxc --use-http '
94+ '--source {} -B {} -r {}'.format(
95+ lp_source, branch_location, self.repo))
96 self.on_remote(cmd)
97
98

Subscribers

People subscribed via source and target branches