Merge lp:~james-page/charms/trusty/glance/tox into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by James Page
Status: Merged
Approved by: Billy Olsen
Approved revision: 140
Merged at revision: 139
Proposed branch: lp:~james-page/charms/trusty/glance/tox
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 255 lines (+90/-23)
10 files modified
.bzrignore (+2/-0)
.testr.conf (+8/-0)
requirements/requirements-precise.txt (+6/-0)
requirements/requirements-trusty.txt (+6/-0)
requirements/test-requirements.txt (+7/-0)
tests/basic_deployment.py (+1/-1)
tox.ini (+35/-0)
unit_tests/test_actions_git_reinstall.py (+3/-0)
unit_tests/test_actions_openstack_upgrade.py (+3/-1)
unit_tests/test_glance_relations.py (+19/-21)
To merge this branch: bzr merge lp:~james-page/charms/trusty/glance/tox
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+271075@code.launchpad.net
To post a comment you must log in.
140. By James Page

Fixup broken tests due to use of invalid assert_ functions

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10045 glance-next for james-page mp271075
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/10045/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9211 glance-next for james-page mp271075
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9211/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10046 glance-next for james-page mp271075
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/10046/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9212 glance-next for james-page mp271075
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9212/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6431 glance-next for james-page mp271075
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12416310/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6431/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6432 glance-next for james-page mp271075
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12416448/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6432/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

\o/ LGTM, nice to be able to run tox. Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-04-01 16:48:59 +0000
3+++ .bzrignore 2015-09-15 08:05:52 +0000
4@@ -1,3 +1,5 @@
5 .coverage
6 bin
7 tags
8+.tox
9+.testrepository
10
11=== added file '.testr.conf'
12--- .testr.conf 1970-01-01 00:00:00 +0000
13+++ .testr.conf 2015-09-15 08:05:52 +0000
14@@ -0,0 +1,8 @@
15+[DEFAULT]
16+test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
17+ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
18+ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
19+ ${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
20+
21+test_id_option=--load-list $IDFILE
22+test_list_option=--list
23
24=== added directory 'requirements'
25=== added file 'requirements/requirements-precise.txt'
26--- requirements/requirements-precise.txt 1970-01-01 00:00:00 +0000
27+++ requirements/requirements-precise.txt 2015-09-15 08:05:52 +0000
28@@ -0,0 +1,6 @@
29+PyYAML==3.10
30+simplejson==2.3.2
31+netifaces==0.8
32+netaddr==0.7.10
33+Jinja2==2.6
34+six==1.1.0
35
36=== added file 'requirements/requirements-trusty.txt'
37--- requirements/requirements-trusty.txt 1970-01-01 00:00:00 +0000
38+++ requirements/requirements-trusty.txt 2015-09-15 08:05:52 +0000
39@@ -0,0 +1,6 @@
40+PyYAML>=3.10
41+simplejson==3.3.1
42+netifaces==0.8
43+netaddr==0.7.10
44+Jinja2==2.7.2
45+six==1.5.2
46
47=== added file 'requirements/test-requirements.txt'
48--- requirements/test-requirements.txt 1970-01-01 00:00:00 +0000
49+++ requirements/test-requirements.txt 2015-09-15 08:05:52 +0000
50@@ -0,0 +1,7 @@
51+testtools==0.9.35
52+coverage==3.7.1
53+mock==1.0.1
54+flake8==2.1.0
55+# No version required
56+charm-tools
57+os-testr
58
59=== modified file 'tests/basic_deployment.py'
60--- tests/basic_deployment.py 2015-08-27 12:15:33 +0000
61+++ tests/basic_deployment.py 2015-09-15 08:05:52 +0000
62@@ -361,7 +361,7 @@
63 expected['keystone_authtoken'].update({
64 'auth_host': rel_ks_gl['auth_host'],
65 'auth_port': rel_ks_gl['auth_port'],
66- 'auth_protocol': rel_ks_gl['auth_protocol']
67+ 'auth_protocol': rel_ks_gl['auth_protocol']
68 })
69
70 return expected
71
72=== added file 'tox.ini'
73--- tox.ini 1970-01-01 00:00:00 +0000
74+++ tox.ini 2015-09-15 08:05:52 +0000
75@@ -0,0 +1,35 @@
76+[tox]
77+# Default to current LTS
78+envlist = lint,py27-trusty
79+skipsdist = True
80+
81+[testenv]
82+setenv = VIRTUAL_ENV={envdir}
83+ PYTHONHASHSEED=0
84+install_command =
85+ pip install --allow-unverified python-apt {opts} {packages}
86+commands = ostestr {posargs}
87+
88+[testenv:py27-precise]
89+basepython = python2.7
90+deps = -r{toxinidir}/requirements/requirements-precise.txt
91+ -r{toxinidir}/requirements/test-requirements.txt
92+
93+[testenv:py27-trusty]
94+basepython = python2.7
95+deps = -r{toxinidir}/requirements/requirements-trusty.txt
96+ -r{toxinidir}/requirements/test-requirements.txt
97+
98+[testenv:lint]
99+basepython = python2.7
100+deps = -r{toxinidir}/requirements/requirements-trusty.txt
101+ -r{toxinidir}/requirements/test-requirements.txt
102+commands = flake8 {posargs} actions hooks unit_tests tests
103+ charm proof
104+
105+[testenv:venv]
106+commands = {posargs}
107+
108+[flake8]
109+ignore = E402,E226
110+exclude = hooks/charmhelpers
111
112=== modified file 'unit_tests/test_actions_git_reinstall.py'
113--- unit_tests/test_actions_git_reinstall.py 2015-08-27 11:45:25 +0000
114+++ unit_tests/test_actions_git_reinstall.py 2015-09-15 08:05:52 +0000
115@@ -13,6 +13,7 @@
116
117 TO_PATCH = [
118 'config',
119+ 'git_install_requested',
120 ]
121
122
123@@ -31,6 +32,7 @@
124 def setUp(self):
125 super(TestGlanceActions, self).setUp(git_reinstall, TO_PATCH)
126 self.config.side_effect = self.test_config.get
127+ self.git_install_requested.return_value = True
128
129 @patch.object(git_reinstall, 'action_set')
130 @patch.object(git_reinstall, 'action_fail')
131@@ -56,6 +58,7 @@
132 def test_git_reinstall_not_configured(self, config_changed, git_install,
133 action_fail, action_set):
134 config.return_value = None
135+ self.git_install_requested.return_value = False
136
137 git_reinstall.git_reinstall()
138
139
140=== modified file 'unit_tests/test_actions_openstack_upgrade.py'
141--- unit_tests/test_actions_openstack_upgrade.py 2015-08-27 09:50:36 +0000
142+++ unit_tests/test_actions_openstack_upgrade.py 2015-09-15 08:05:52 +0000
143@@ -12,7 +12,8 @@
144 )
145
146 TO_PATCH = [
147- 'config'
148+ 'config',
149+ 'git_install_requested',
150 ]
151
152
153@@ -22,6 +23,7 @@
154 super(TestGlanceUpgradeActions, self).setUp(openstack_upgrade,
155 TO_PATCH)
156 self.config.side_effect = self.test_config.get
157+ self.git_install_requested.return_value = False
158
159 @patch.object(openstack_upgrade, 'action_set')
160 @patch.object(openstack_upgrade, 'action_fail')
161
162=== modified file 'unit_tests/test_glance_relations.py'
163--- unit_tests/test_glance_relations.py 2015-09-12 06:27:17 +0000
164+++ unit_tests/test_glance_relations.py 2015-09-15 08:05:52 +0000
165@@ -143,13 +143,8 @@
166 hostname='glance.foohost.com')
167 self.unit_get.assert_called_with('private-address')
168
169- @patch.object(relations, 'sync_db_with_multi_ipv6_addresses')
170- @patch.object(relations, 'get_ipv6_addr')
171- def test_db_joined_with_ipv6(self, mock_get_ipv6_addr,
172- mock_sync_db):
173+ def test_db_joined_with_ipv6(self):
174 self.test_config.set('prefer-ipv6', True)
175- mock_get_ipv6_addr.return_value = ['2001:db8:1::1']
176- mock_sync_db.return_value = MagicMock()
177 self.is_relation_made.return_value = False
178 relations.db_joined()
179 relation_data = {
180@@ -158,9 +153,8 @@
181 }
182 relation_data['hostname'] = '2001:db8:1::1'
183
184- self.sync_db_with_multi_ipv6_addresses.assert_called_with_once(
185+ self.sync_db_with_multi_ipv6_addresses.assert_called_with(
186 'glance', 'glance')
187- self.get_ipv6_addr.assert_called_once()
188
189 def test_postgresql_db_joined(self):
190 self.unit_get.return_value = 'glance.foohost.com'
191@@ -724,9 +718,10 @@
192 configs.write = MagicMock()
193 self.relation_ids.return_value = ['identity-service:0']
194 relations.configure_https()
195- calls = [call('a2dissite', 'openstack_https_frontend'),
196- call('service', 'apache2', 'reload')]
197- self.check_call.assert_called_has_calls(calls)
198+ self.check_call.assert_called_with(['a2ensite',
199+ 'openstack_https_frontend'])
200+ self.service_reload.assert_called_with('apache2',
201+ restart_on_failure=True)
202 keystone_joined.assert_called_with(relation_id='identity-service:0')
203
204 @patch.object(relations, 'canonical_url')
205@@ -739,9 +734,10 @@
206 configs.write = MagicMock()
207 self.relation_ids.return_value = ['identity-service:0']
208 relations.configure_https()
209- calls = [call('a2dissite', 'openstack_https_frontend'),
210- call('service', 'apache2', 'reload')]
211- self.check_call.assert_called_has_calls(calls)
212+ self.check_call.assert_called_with(['a2dissite',
213+ 'openstack_https_frontend'])
214+ self.service_reload.assert_called_with('apache2',
215+ restart_on_failure=True)
216 keystone_joined.assert_called_with(relation_id='identity-service:0')
217
218 @patch.object(relations, 'canonical_url')
219@@ -754,9 +750,10 @@
220 configs.write = MagicMock()
221 self.relation_ids.return_value = ['image-service:0']
222 relations.configure_https()
223- calls = [call('a2dissite', 'openstack_https_frontend'),
224- call('service', 'apache2', 'reload')]
225- self.check_call.assert_called_has_calls(calls)
226+ self.check_call.assert_called_with(['a2ensite',
227+ 'openstack_https_frontend'])
228+ self.service_reload.assert_called_with('apache2',
229+ restart_on_failure=True)
230 image_service_joined.assert_called_with(relation_id='image-service:0')
231
232 @patch.object(relations, 'canonical_url')
233@@ -769,9 +766,10 @@
234 configs.write = MagicMock()
235 self.relation_ids.return_value = ['image-service:0']
236 relations.configure_https()
237- calls = [call('a2dissite', 'openstack_https_frontend'),
238- call('service', 'apache2', 'reload')]
239- self.check_call.assert_called_has_calls(calls)
240+ self.check_call.assert_called_with(['a2dissite',
241+ 'openstack_https_frontend'])
242+ self.service_reload.assert_called_with('apache2',
243+ restart_on_failure=True)
244 image_service_joined.assert_called_with(relation_id='image-service:0')
245
246 def test_amqp_joined(self):
247@@ -785,7 +783,7 @@
248 configs.complete_contexts = MagicMock()
249 configs.complete_contexts.return_value = []
250 relations.amqp_changed()
251- self.juju_log.assert_called()
252+ self.assertTrue(self.juju_log.called)
253
254 @patch.object(relations, 'CONFIGS')
255 def test_amqp_changed_relation_data(self, configs):

Subscribers

People subscribed via source and target branches