Merge lp:~james-page/charms/trusty/glance/tox into lp:~openstack-charmers-archive/charms/trusty/glance/next
- Trusty Tahr (14.04)
- tox
- Merge into next
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Billy Olsen | Approve | ||
Review via email: mp+271075@code.launchpad.net |
Commit message
Description of the change
- 140. By James Page
-
Fixup broken tests due to use of invalid assert_ functions
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9211 glance-next for james-page mp271075
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10046 glance-next for james-page mp271075
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9212 glance-next for james-page mp271075
UNIT OK: passed
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://
Build: http://
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://
Build: http://
Billy Olsen (billy-olsen) wrote : | # |
\o/ LGTM, nice to be able to run tox. Approved!
Preview Diff
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 | 1 | .coverage | 1 | .coverage |
6 | 2 | bin | 2 | bin |
7 | 3 | tags | 3 | tags |
8 | 4 | .tox | ||
9 | 5 | .testrepository | ||
10 | 4 | 6 | ||
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 | 1 | [DEFAULT] | ||
16 | 2 | test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ | ||
17 | 3 | OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ | ||
18 | 4 | OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ | ||
19 | 5 | ${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION | ||
20 | 6 | |||
21 | 7 | test_id_option=--load-list $IDFILE | ||
22 | 8 | test_list_option=--list | ||
23 | 0 | 9 | ||
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 | 1 | PyYAML==3.10 | ||
30 | 2 | simplejson==2.3.2 | ||
31 | 3 | netifaces==0.8 | ||
32 | 4 | netaddr==0.7.10 | ||
33 | 5 | Jinja2==2.6 | ||
34 | 6 | six==1.1.0 | ||
35 | 0 | 7 | ||
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 | 1 | PyYAML>=3.10 | ||
41 | 2 | simplejson==3.3.1 | ||
42 | 3 | netifaces==0.8 | ||
43 | 4 | netaddr==0.7.10 | ||
44 | 5 | Jinja2==2.7.2 | ||
45 | 6 | six==1.5.2 | ||
46 | 0 | 7 | ||
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 | 1 | testtools==0.9.35 | ||
52 | 2 | coverage==3.7.1 | ||
53 | 3 | mock==1.0.1 | ||
54 | 4 | flake8==2.1.0 | ||
55 | 5 | # No version required | ||
56 | 6 | charm-tools | ||
57 | 7 | os-testr | ||
58 | 0 | 8 | ||
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 | 361 | expected['keystone_authtoken'].update({ | 361 | expected['keystone_authtoken'].update({ |
64 | 362 | 'auth_host': rel_ks_gl['auth_host'], | 362 | 'auth_host': rel_ks_gl['auth_host'], |
65 | 363 | 'auth_port': rel_ks_gl['auth_port'], | 363 | 'auth_port': rel_ks_gl['auth_port'], |
67 | 364 | 'auth_protocol': rel_ks_gl['auth_protocol'] | 364 | 'auth_protocol': rel_ks_gl['auth_protocol'] |
68 | 365 | }) | 365 | }) |
69 | 366 | 366 | ||
70 | 367 | return expected | 367 | return expected |
71 | 368 | 368 | ||
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 | 1 | [tox] | ||
77 | 2 | # Default to current LTS | ||
78 | 3 | envlist = lint,py27-trusty | ||
79 | 4 | skipsdist = True | ||
80 | 5 | |||
81 | 6 | [testenv] | ||
82 | 7 | setenv = VIRTUAL_ENV={envdir} | ||
83 | 8 | PYTHONHASHSEED=0 | ||
84 | 9 | install_command = | ||
85 | 10 | pip install --allow-unverified python-apt {opts} {packages} | ||
86 | 11 | commands = ostestr {posargs} | ||
87 | 12 | |||
88 | 13 | [testenv:py27-precise] | ||
89 | 14 | basepython = python2.7 | ||
90 | 15 | deps = -r{toxinidir}/requirements/requirements-precise.txt | ||
91 | 16 | -r{toxinidir}/requirements/test-requirements.txt | ||
92 | 17 | |||
93 | 18 | [testenv:py27-trusty] | ||
94 | 19 | basepython = python2.7 | ||
95 | 20 | deps = -r{toxinidir}/requirements/requirements-trusty.txt | ||
96 | 21 | -r{toxinidir}/requirements/test-requirements.txt | ||
97 | 22 | |||
98 | 23 | [testenv:lint] | ||
99 | 24 | basepython = python2.7 | ||
100 | 25 | deps = -r{toxinidir}/requirements/requirements-trusty.txt | ||
101 | 26 | -r{toxinidir}/requirements/test-requirements.txt | ||
102 | 27 | commands = flake8 {posargs} actions hooks unit_tests tests | ||
103 | 28 | charm proof | ||
104 | 29 | |||
105 | 30 | [testenv:venv] | ||
106 | 31 | commands = {posargs} | ||
107 | 32 | |||
108 | 33 | [flake8] | ||
109 | 34 | ignore = E402,E226 | ||
110 | 35 | exclude = hooks/charmhelpers | ||
111 | 0 | 36 | ||
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 | 13 | 13 | ||
117 | 14 | TO_PATCH = [ | 14 | TO_PATCH = [ |
118 | 15 | 'config', | 15 | 'config', |
119 | 16 | 'git_install_requested', | ||
120 | 16 | ] | 17 | ] |
121 | 17 | 18 | ||
122 | 18 | 19 | ||
123 | @@ -31,6 +32,7 @@ | |||
124 | 31 | def setUp(self): | 32 | def setUp(self): |
125 | 32 | super(TestGlanceActions, self).setUp(git_reinstall, TO_PATCH) | 33 | super(TestGlanceActions, self).setUp(git_reinstall, TO_PATCH) |
126 | 33 | self.config.side_effect = self.test_config.get | 34 | self.config.side_effect = self.test_config.get |
127 | 35 | self.git_install_requested.return_value = True | ||
128 | 34 | 36 | ||
129 | 35 | @patch.object(git_reinstall, 'action_set') | 37 | @patch.object(git_reinstall, 'action_set') |
130 | 36 | @patch.object(git_reinstall, 'action_fail') | 38 | @patch.object(git_reinstall, 'action_fail') |
131 | @@ -56,6 +58,7 @@ | |||
132 | 56 | def test_git_reinstall_not_configured(self, config_changed, git_install, | 58 | def test_git_reinstall_not_configured(self, config_changed, git_install, |
133 | 57 | action_fail, action_set): | 59 | action_fail, action_set): |
134 | 58 | config.return_value = None | 60 | config.return_value = None |
135 | 61 | self.git_install_requested.return_value = False | ||
136 | 59 | 62 | ||
137 | 60 | git_reinstall.git_reinstall() | 63 | git_reinstall.git_reinstall() |
138 | 61 | 64 | ||
139 | 62 | 65 | ||
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 | 12 | ) | 12 | ) |
145 | 13 | 13 | ||
146 | 14 | TO_PATCH = [ | 14 | TO_PATCH = [ |
148 | 15 | 'config' | 15 | 'config', |
149 | 16 | 'git_install_requested', | ||
150 | 16 | ] | 17 | ] |
151 | 17 | 18 | ||
152 | 18 | 19 | ||
153 | @@ -22,6 +23,7 @@ | |||
154 | 22 | super(TestGlanceUpgradeActions, self).setUp(openstack_upgrade, | 23 | super(TestGlanceUpgradeActions, self).setUp(openstack_upgrade, |
155 | 23 | TO_PATCH) | 24 | TO_PATCH) |
156 | 24 | self.config.side_effect = self.test_config.get | 25 | self.config.side_effect = self.test_config.get |
157 | 26 | self.git_install_requested.return_value = False | ||
158 | 25 | 27 | ||
159 | 26 | @patch.object(openstack_upgrade, 'action_set') | 28 | @patch.object(openstack_upgrade, 'action_set') |
160 | 27 | @patch.object(openstack_upgrade, 'action_fail') | 29 | @patch.object(openstack_upgrade, 'action_fail') |
161 | 28 | 30 | ||
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 | 143 | hostname='glance.foohost.com') | 143 | hostname='glance.foohost.com') |
167 | 144 | self.unit_get.assert_called_with('private-address') | 144 | self.unit_get.assert_called_with('private-address') |
168 | 145 | 145 | ||
173 | 146 | @patch.object(relations, 'sync_db_with_multi_ipv6_addresses') | 146 | def test_db_joined_with_ipv6(self): |
170 | 147 | @patch.object(relations, 'get_ipv6_addr') | ||
171 | 148 | def test_db_joined_with_ipv6(self, mock_get_ipv6_addr, | ||
172 | 149 | mock_sync_db): | ||
174 | 150 | self.test_config.set('prefer-ipv6', True) | 147 | self.test_config.set('prefer-ipv6', True) |
175 | 151 | mock_get_ipv6_addr.return_value = ['2001:db8:1::1'] | ||
176 | 152 | mock_sync_db.return_value = MagicMock() | ||
177 | 153 | self.is_relation_made.return_value = False | 148 | self.is_relation_made.return_value = False |
178 | 154 | relations.db_joined() | 149 | relations.db_joined() |
179 | 155 | relation_data = { | 150 | relation_data = { |
180 | @@ -158,9 +153,8 @@ | |||
181 | 158 | } | 153 | } |
182 | 159 | relation_data['hostname'] = '2001:db8:1::1' | 154 | relation_data['hostname'] = '2001:db8:1::1' |
183 | 160 | 155 | ||
185 | 161 | self.sync_db_with_multi_ipv6_addresses.assert_called_with_once( | 156 | self.sync_db_with_multi_ipv6_addresses.assert_called_with( |
186 | 162 | 'glance', 'glance') | 157 | 'glance', 'glance') |
187 | 163 | self.get_ipv6_addr.assert_called_once() | ||
188 | 164 | 158 | ||
189 | 165 | def test_postgresql_db_joined(self): | 159 | def test_postgresql_db_joined(self): |
190 | 166 | self.unit_get.return_value = 'glance.foohost.com' | 160 | self.unit_get.return_value = 'glance.foohost.com' |
191 | @@ -724,9 +718,10 @@ | |||
192 | 724 | configs.write = MagicMock() | 718 | configs.write = MagicMock() |
193 | 725 | self.relation_ids.return_value = ['identity-service:0'] | 719 | self.relation_ids.return_value = ['identity-service:0'] |
194 | 726 | relations.configure_https() | 720 | relations.configure_https() |
198 | 727 | calls = [call('a2dissite', 'openstack_https_frontend'), | 721 | self.check_call.assert_called_with(['a2ensite', |
199 | 728 | call('service', 'apache2', 'reload')] | 722 | 'openstack_https_frontend']) |
200 | 729 | self.check_call.assert_called_has_calls(calls) | 723 | self.service_reload.assert_called_with('apache2', |
201 | 724 | restart_on_failure=True) | ||
202 | 730 | keystone_joined.assert_called_with(relation_id='identity-service:0') | 725 | keystone_joined.assert_called_with(relation_id='identity-service:0') |
203 | 731 | 726 | ||
204 | 732 | @patch.object(relations, 'canonical_url') | 727 | @patch.object(relations, 'canonical_url') |
205 | @@ -739,9 +734,10 @@ | |||
206 | 739 | configs.write = MagicMock() | 734 | configs.write = MagicMock() |
207 | 740 | self.relation_ids.return_value = ['identity-service:0'] | 735 | self.relation_ids.return_value = ['identity-service:0'] |
208 | 741 | relations.configure_https() | 736 | relations.configure_https() |
212 | 742 | calls = [call('a2dissite', 'openstack_https_frontend'), | 737 | self.check_call.assert_called_with(['a2dissite', |
213 | 743 | call('service', 'apache2', 'reload')] | 738 | 'openstack_https_frontend']) |
214 | 744 | self.check_call.assert_called_has_calls(calls) | 739 | self.service_reload.assert_called_with('apache2', |
215 | 740 | restart_on_failure=True) | ||
216 | 745 | keystone_joined.assert_called_with(relation_id='identity-service:0') | 741 | keystone_joined.assert_called_with(relation_id='identity-service:0') |
217 | 746 | 742 | ||
218 | 747 | @patch.object(relations, 'canonical_url') | 743 | @patch.object(relations, 'canonical_url') |
219 | @@ -754,9 +750,10 @@ | |||
220 | 754 | configs.write = MagicMock() | 750 | configs.write = MagicMock() |
221 | 755 | self.relation_ids.return_value = ['image-service:0'] | 751 | self.relation_ids.return_value = ['image-service:0'] |
222 | 756 | relations.configure_https() | 752 | relations.configure_https() |
226 | 757 | calls = [call('a2dissite', 'openstack_https_frontend'), | 753 | self.check_call.assert_called_with(['a2ensite', |
227 | 758 | call('service', 'apache2', 'reload')] | 754 | 'openstack_https_frontend']) |
228 | 759 | self.check_call.assert_called_has_calls(calls) | 755 | self.service_reload.assert_called_with('apache2', |
229 | 756 | restart_on_failure=True) | ||
230 | 760 | image_service_joined.assert_called_with(relation_id='image-service:0') | 757 | image_service_joined.assert_called_with(relation_id='image-service:0') |
231 | 761 | 758 | ||
232 | 762 | @patch.object(relations, 'canonical_url') | 759 | @patch.object(relations, 'canonical_url') |
233 | @@ -769,9 +766,10 @@ | |||
234 | 769 | configs.write = MagicMock() | 766 | configs.write = MagicMock() |
235 | 770 | self.relation_ids.return_value = ['image-service:0'] | 767 | self.relation_ids.return_value = ['image-service:0'] |
236 | 771 | relations.configure_https() | 768 | relations.configure_https() |
240 | 772 | calls = [call('a2dissite', 'openstack_https_frontend'), | 769 | self.check_call.assert_called_with(['a2dissite', |
241 | 773 | call('service', 'apache2', 'reload')] | 770 | 'openstack_https_frontend']) |
242 | 774 | self.check_call.assert_called_has_calls(calls) | 771 | self.service_reload.assert_called_with('apache2', |
243 | 772 | restart_on_failure=True) | ||
244 | 775 | image_service_joined.assert_called_with(relation_id='image-service:0') | 773 | image_service_joined.assert_called_with(relation_id='image-service:0') |
245 | 776 | 774 | ||
246 | 777 | def test_amqp_joined(self): | 775 | def test_amqp_joined(self): |
247 | @@ -785,7 +783,7 @@ | |||
248 | 785 | configs.complete_contexts = MagicMock() | 783 | configs.complete_contexts = MagicMock() |
249 | 786 | configs.complete_contexts.return_value = [] | 784 | configs.complete_contexts.return_value = [] |
250 | 787 | relations.amqp_changed() | 785 | relations.amqp_changed() |
252 | 788 | self.juju_log.assert_called() | 786 | self.assertTrue(self.juju_log.called) |
253 | 789 | 787 | ||
254 | 790 | @patch.object(relations, 'CONFIGS') | 788 | @patch.object(relations, 'CONFIGS') |
255 | 791 | def test_amqp_changed_relation_data(self, configs): | 789 | def test_amqp_changed_relation_data(self, configs): |
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/