Merge lp:~vila/uci-engine/integration-speed-up into lp:uci-engine

Proposed by Vincent Ladeuil on 2014-06-13
Status: Rejected
Rejected by: Vincent Ladeuil on 2014-06-24
Proposed branch: lp:~vila/uci-engine/integration-speed-up
Merge into: lp:uci-engine
Prerequisite: lp:~doanac/uci-engine/integration-speed-up
Diff against target: 190 lines (+29/-20)
8 files modified
tests/deployers.py (+7/-13)
tests/test_image_builder.py (+5/-1)
tests/test_integration.py (+3/-1)
tests/test_ppa_assigner.py (+3/-1)
tests/test_publisher.py (+3/-1)
tests/test_test_runner.py (+4/-1)
tests/test_ticket_system.py (+2/-1)
tests/test_webui.py (+2/-1)
To merge this branch: bzr merge lp:~vila/uci-engine/integration-speed-up
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2014-06-13
Canonical CI Engineering 2014-06-13 Pending
Review via email: mp+223065@code.launchpad.net

Commit message

Teach AmuletDeployment() to skip the deployment when one is already available.

Description of the change

This changes lp:~doanac/uci-engine/integration-speed-up to minimize the scope of the workaround.

Andy, we've been talking past each other I think, let me restart the discussion:

1) We are bitten hard by https://bugs.launchpad.net/juju-core/+bug/1200267

IMO, It's the most important issue we face for the current "integration" tests: I thought you had some insight about what was going on hence my question. You don't. Damn. Me neither. Damn damn.

I don't want this issue to get out of our radar hence the comment in setUp() in this proposal. If we kick the can, let's make sure it's still in front of us.

2) We need a workaround in the mean time.

I'm fine with that but I want that workaround to be expressed in the right place: at the test level.

I want (like you), as a dev, to be in charge of the environment where my test run.

I *don't* want to have to tell the test runner about that.

You proposed to use an env var for that, there is no need for a class
attribute to duplicate that information.

bzr diffstat for this proposal is:

  1 file changed, 14 insertions(+), 10 deletions(-)

yours was:

    8 files changed, 26 insertions(+), 31 deletions(-)

I don't want to carry those additional changes.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:563
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/860/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/860/rebuild

review: Approve (continuous-integration)

Unmerged revisions

563. By Vincent Ladeuil on 2014-06-13

Simplify DEPLOYED handling. The only place we care about it is in AmuletDeployment.setUp().

562. By Andy Doan on 2014-06-11

integration tests: allow re-use of a deployed environment

This allows us to deploy once and then run our integration tests
against a deployed environment. This greatly speeds up local testing.

This is disabled by default, but specifying DEPLOYED=1 in your
environment allows you take advantage of this. I'm running things
at home with:

 DEPLOYED=1 JUJU_REPOSITORY=`pwd`/tmp/charms PATH=$PATH:`pwd`/branches/juju-deployer JUJU_DEPLOYER_DIR=`pwd`/tmp ./tests/test_webui.py

I'm not a huge fan of "DEPLOYED=1" but unittest.main has its own argparse
logic, so we screw that up if we try to accept CLI args. Even if this
idea is terrible, its local to one place so we can easily fix it in
the future w/o touching our other code.

This makes testing the webui go from 76s to 4s when using juju-lxc

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/deployers.py'
2--- tests/deployers.py 2014-06-13 13:01:42 +0000
3+++ tests/deployers.py 2014-06-13 13:01:42 +0000
4@@ -19,7 +19,6 @@
5 import sys
6 import time
7 import logging
8-import unittest
9
10 import amulet
11
12@@ -32,7 +31,7 @@
13
14 from ci_utils import testing
15 from ci_utils.testing import features
16-from ci_utils.testing.deployer import load_configs
17+from ci_utils.testing import deployer
18
19
20 class AmuletDeployment(object):
21@@ -66,15 +65,16 @@
22 # better understand what is going on. -- vila 2014-06-05
23 timeout = 1200
24
25- deployed = False
26-
27 def setUp(self):
28 super(DeployerTest, self).setUp()
29 self.deployer = AmuletDeployment()
30- if not DeployerTest.deployed:
31+ # FIXME: Until http://pad.lv/1200267 is fixed, we want a way to reuse
32+ # an existing deployment that has been setup and validated before the
33+ # tests are run. This is controlled by the 'DEPLOYED' env var being set
34+ # -- vila 2014-06-13.
35+ if 'DEPLOYED' not in os.environ:
36 deployer_dir = os.environ['JUJU_DEPLOYER_DIR']
37- script = testing.deployer.load_configs(
38- deployer_dir, self.deployer_cfgs)
39+ script = deployer.load_configs(deployer_dir, self.deployer_cfgs)
40 self.fixup_includes(script, deployer_dir)
41 self.add_extra_relations(script)
42 self.deployer.load(script)
43@@ -135,9 +135,3 @@
44 ]
45 output = subprocess.check_output(args)
46 self.assertIn('start/running', output)
47-
48-
49-def main():
50- if 'DEPLOYED' in os.environ:
51- DeployerTest.deployed = True
52- unittest.main()
53
54=== modified file 'tests/test_image_builder.py'
55--- tests/test_image_builder.py 2014-06-13 13:01:42 +0000
56+++ tests/test_image_builder.py 2014-06-06 07:18:50 +0000
57@@ -14,6 +14,10 @@
58 # You should have received a copy of the GNU Affero General Public License
59 # along with this program. If not, see <http://www.gnu.org/licenses/>.
60
61+
62+import unittest
63+
64+
65 import deployers
66
67
68@@ -29,4 +33,4 @@
69
70
71 if __name__ == "__main__":
72- deployers.main()
73+ unittest.main()
74
75=== modified file 'tests/test_integration.py'
76--- tests/test_integration.py 2014-06-13 13:01:42 +0000
77+++ tests/test_integration.py 2014-06-11 18:04:13 +0000
78@@ -21,10 +21,12 @@
79 import subprocess
80 import sys
81 import tempfile
82+import unittest
83
84 from ucitests import fixtures as uci_fixtures
85 import deployers
86
87+
88 HERE = os.path.abspath(os.path.dirname(__file__))
89 sys.path.append(os.path.join(HERE, '..', 'ci-utils'))
90
91@@ -152,4 +154,4 @@
92
93
94 if __name__ == "__main__":
95- deployers.main()
96+ unittest.main()
97
98=== modified file 'tests/test_ppa_assigner.py'
99--- tests/test_ppa_assigner.py 2014-06-13 13:01:42 +0000
100+++ tests/test_ppa_assigner.py 2014-06-06 07:18:50 +0000
101@@ -17,6 +17,8 @@
102 import httplib2
103 import json
104 import os
105+import unittest
106+
107
108 import deployers
109
110@@ -148,4 +150,4 @@
111
112
113 if __name__ == "__main__":
114- deployers.main()
115+ unittest.main()
116
117=== modified file 'tests/test_publisher.py'
118--- tests/test_publisher.py 2014-06-13 13:01:42 +0000
119+++ tests/test_publisher.py 2014-06-06 07:18:50 +0000
120@@ -13,6 +13,8 @@
121
122 # You should have received a copy of the GNU Affero General Public License
123 # along with this program. If not, see <http://www.gnu.org/licenses/>.
124+import unittest
125+
126 import deployers
127
128
129@@ -29,4 +31,4 @@
130
131
132 if __name__ == "__main__":
133- deployers.main()
134+ unittest.main()
135
136=== modified file 'tests/test_test_runner.py'
137--- tests/test_test_runner.py 2014-06-13 13:01:42 +0000
138+++ tests/test_test_runner.py 2014-06-06 07:18:50 +0000
139@@ -13,6 +13,9 @@
140
141 # You should have received a copy of the GNU Affero General Public License
142 # along with this program. If not, see <http://www.gnu.org/licenses/>.
143+
144+import unittest
145+
146 import deployers
147
148
149@@ -28,4 +31,4 @@
150
151
152 if __name__ == "__main__":
153- deployers.main()
154+ unittest.main()
155
156=== modified file 'tests/test_ticket_system.py'
157--- tests/test_ticket_system.py 2014-06-13 13:01:42 +0000
158+++ tests/test_ticket_system.py 2014-06-06 19:54:07 +0000
159@@ -15,6 +15,7 @@
160 # along with this program. If not, see <http://www.gnu.org/licenses/>.
161 import httplib2
162 import json
163+import unittest
164
165 import deployers
166
167@@ -121,4 +122,4 @@
168
169
170 if __name__ == "__main__":
171- deployers.main()
172+ unittest.main()
173
174=== modified file 'tests/test_webui.py'
175--- tests/test_webui.py 2014-06-13 13:01:42 +0000
176+++ tests/test_webui.py 2014-06-10 16:57:22 +0000
177@@ -16,6 +16,7 @@
178 import json
179
180 import httplib2
181+import unittest
182
183 import deployers
184
185@@ -58,4 +59,4 @@
186
187
188 if __name__ == "__main__":
189- deployers.main()
190+ unittest.main()

Subscribers

People subscribed via source and target branches